Blog

Why ImpressCMS, and all other XOOPS based systems suck.

First let me state that this is not a flame, this is just a high spirited post intended to incite rational thought about a subject that continues to be neglected in all xoops based systems. If you want to share your opinion or call me a dumb ass the comment form is wide open. You are welcome to use it.

Over the last decade I have contributed to many CMS platforms, the most abundantly of which has gone to XOOPS and XOOPS based systems. A long time ago the XOOPS community was a vibrant, buzzing geek utopia. Everyone was incredibly nice, everyone was helpful, and more importantly a solid product was being developed efficiently and with such passion you would have thought that nothing would ever take its place. XOOPS was the bees knees in mine and thousands of other developers/designers/users eyes, and no one could tell us otherwise. With time developers began falling off, feuding began to outweigh progress, and the community divided (once again) as a new project took form called ImpressCMS.

For several years before this event, I had become increasingly agitated with the state of the core, and the fact that the spirit that once thrived in that community of sharing ideas was gone. The developers didn’t listen to the people. No longer could johnny noname come into the forums with a great idea, and contribute towards the greater benefit of the system. The development had become tunneled down into the small vision of just a few developers. Those developers didn’t care to interact with the community at all, and as a result the entire project became disjointed.

Now a new project was born. ImpressCMS. ImpressCMS was supposed to be a new beginning, a fresh start for the XOOPS core. Everyone was invited to come and contribute everyone was invited to shape the system into a truly community centric system. Or that is what the users were supposed to believe. I will give credit where credit is due. The system has come a long way from XOOPS, so much that the better ideas from ImpressCMS were actually rolled back into XOOPS after they were implemented into ICMS (ah open source spirit).

I am getting to a point, try and stay with me.

Here is why these systems will always suck, and are in and of themselves their own worst enemy. Smarty. Smarty is quite possible the worst template engine available in my professional opinion.

It is limiting, and because of this both systems are inflexible and stubborn to work with. Go build a wordpress theme and write up your own cool ass admin panel with awesome options and then come build an ImpressCMS theme. Now go do Drupal and bathe in the glory that is phptemplate. Now come back to ImpressCMS. What’s wrong? Do you miss being able to do logical things without being limited by smarty?

See, XOOPS core based systems have a reasoning behind their insistence to use smarty. That it is “easy”. Easy for whom exactly? No idea…

Users are expected to learn an entirely different language for the most part, and theme designers are expected to simply deal with the cards they are dealt by the core and module developers. They tout messages like “separation of logic and design layers” However, logic in and of itself is subject to perspective. It is in fact illogical to assume you will know what every user will want to display, so why should you be given the power to do so?

This little oversight by the core developers has cost the system a great deal. At no point did the core developers of either system ask, or re-ask (perhaps I missed it) the presentation layer people if smarty was the best choice. Someone was just googling one day, saw smarty and was like “ooh people will love this, because that is my opinion.” Its not true, the fact that you chose smarty, and these systems continue to use it as their primary template engine, is the reason all of your systems do not have theme designers. No real designers wants to constantly redesign the same cereal box. They want to be unrestricted, free to invent and create.

So, for you ICMS users. This is what I am going to do. I am going to show you how you can enable php support in your theme directory. Ssh, don’t tell the developers, they might smack you with a compliance stick.

Let’s just assume you are playing with ICMS 1.3 (if you are rocking XOOPS, perhaps one of their people can help you with this).

Alright, so in ICMS 1.3 navigate to libraries/icms/view/Tpl.php and find this function

public function __construct() {

Right before this function closes add this line

$this->trusted_dir = ICMS_THEME_PATH;

Booyah! you can now rock php. However – the devs have still made it a real pain in the ass to invoke it so let’s trick em a bit. Assuming you are messing with iTheme for testing let’s create a file named functions.php in that folder and add the following lines to the top of your theme.html file.

<{assign var=theme_name value=$xoTheme->folderName}><{include_php file="$theme_name/functions.php"}>

So, I am going to assume you know how to write php scripts and just give you a quick example to illustrate your limitless possibilities.

	global $xoopsDB, $xoopsTpl;
	
	$link = mysql_connect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS);
	//Let's create a table if one doesn't exist
	$sql = "CREATE TABLE IF NOT EXISTS " . $GLOBALS['xoopsDB']->prefix() . "_theme_options (oid VARCHAR(255), val VARCHAR(255))";
	mysql_query($sql, $link) or die(mysql_error());

refresh you page and check your database to see your new table created. Now you can do things like:

$addrows = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix() . "_theme_options (oid, val) VALUES ('first_link_title', 'Home')";
mysql_query($addrows, $link) or die(mysql_error());

Oh my, we have table rows people! What if we?

	$getem = mysql_query("SELECT * FROM " . $GLOBALS['xoopsDB']->prefix() . "_theme_options");
	while($row = mysql_fetch_array($getem) ) {
		$theval = $row['val'];
		$xoopsTpl->assign('foo',$theval);
	}

No! no way it could be that simple right? Alright, lets find out. Go back to theme.html and find the nav menu section. Look at that first link and change it to this.

<{$foo}>

Voila! You can now get all kinds of fancy, make your own wordpress inspired admin panels, or just use php to store some values in the database and grab them as needed. The point is, that you aren’t restricted by opinions.

Hope you find it useful, and even more hopeful that you systems using smarty will wise up. It sucks.

Posted in: ImpressCMS

Leave a Comment (8) →

8 Comments

  1. Steve K March 15, 2011

    Well, this brings back to mind quite a few conversations about code/design/themes/templates and what to do about them. :)

    What to do when every theme out there is based on Smarty, every module is written to output to Smarty via $xoopsTpl? Take out Smarty? Kind of a Catch-22.

    From what I’m reading here, it doesn’t seem to be the limitations for creating the design or the markup, but rather for the data you want to include.

    Views module, anyone?

    reply
  2. Will March 16, 2011

    Thanks for the post Steve!

    You are right, this is definitely one of those subjects that seems to repeat itself every few months. Especially from me.

    Here is an observation I have for you:
    ICMS 1.3 is a huge refactoring, and as it is such, a vast majority of modules have ceased to work. This means all of those modules are having to be updated just to work with the latest core.

    Themes are scarce at best, there is currently really only one active releaser on ICMS. I stand to argue that smarty is the sole contributor to this problem.

    Smarty should absolutely never have been so tightly integrated with xoops, so ICMS inherited the problem and I appreciate that. However, based on ICMS policy, everything that can be a plugin–should be. I believe smarty falls heavily into that category. Now I know that the way the system is in its current state smarty is pretty much the scaffolding, but it doesn’t have to be that way. Smarty could and should be optional.

    Drupal shows it best how a CMF can provide multiple template engines, and even in that scenario phptemplate still outperformed and outproduced all competitors. The reason is simple, professionals want flexibility, and they want control: and they don’t want to learn a new language just to do it. Not that smarty is difficult to learn, but it is obnoxious and unnecessary. I certainly do not expect a change like this to occur overnight, but the stats don’t lie–if you want to build a top-3 cms, you need to drop smarty. Without it more contributors will come. Especially with the awesome IPF, if programmers didn’t have to muddle in smarty templates, oh man… ICMS would stand a chance.

    If ICMS stripped out smarty I would gladly volunteer my time to rewrite all of the system templates in phptemplate.

    reply
  3. Steve K March 17, 2011

    I completely agree about smarty should be treated as an optional plugin and other engines should be supported. The difficulty arises in getting to that point. Tearing apart the core, as we have in refactoring for the 1.3 release, has produced a lot of good things and also been a huge educational experience.

    When xoops first introduced smarty, it was accessed directly – a template was defined by creating a new smarty instance. Absolutely binding and defining their dependance on it. Only slightly better is the xoopstpl object which is just a wrapper for smarty and not a general abstracted class. Skalpa knew this was wrong and introduced the xoopstheme class, the first major step towards making xoops independent of the template engine and opening up the way for other engines to be used.

    So, to really fix the problem, everyone needs to stop using icms_view_Tpl (xoopstpl) and start using icms_view_theme_Object instead. The solution has existed for a long time – no one has ever realized it or known what to do with it.

    As for the majority of modules being broken by 1.3, that’s not completely accurate. They will definitely throw a lot of error messages pointing out what will not work in future versions, but we have worked hard to make migration possible and to identify those modules you can trust to work in the future. If no one is working to make them forward compatible, it’s time to look for alternatives.

    reply
  4. debianus March 25, 2011

    Hello Will
    Great design! I love this page.

    About Smarty: you are right. Why are the big WordPress or Drupal? There are several reasons, but one is template engine. How many designers make WordPress themes? Tons. Why? Well, if there are tons of users will be tons of designers, but in WordPress themes you have admin panel, languages, top or bottom panels, etc.
    If I want use a page design for a module or one page, now I have etc. But if an user want change this, he must change code, not just a click. There are a lot of examples as that (change image header for each module, custom blocks for footer, etc.)
    Too we have plugins or modules, but about plugins could be more possibilities as WordPress has for codes for scripts.

    reply
  5. Francis d June 11, 2011

    I fully agree with you. XOOPS 2.5 ImpressCMS, and many other SimpleCMS CMS all have the same problem. It’s a big problem to get a professional looking template. Developers must understand that these CMS web design is a job itself. This Requier important skills if you want to create a theme worthy of the name. While not surprising to see the popularity of WordPress, Joomla, Drupal! It’s clear! It is a question template extremely easy to implement. For $ 35 you have an extra design work.

    I often download Xoops release, ImpressCMS for testing locally. I often liked to use these CMS but when it comes time to think about building a website! 0 template was worthy of the name. Then we pass our way. This is the big problem of many CMS. Well think in terms of functionality, but nothing in the design.

    Since the time that this discussion back in those respective forums CMS nothing moving in the template engine. While it remains alone use it.

    It’s a bad thing that resist changement

    Good article

    reply
  6. Simon June 25, 2011

    I suspect most people are like me and just using Smarty because that’s what is there. If there’s a better way, I’m all for it. And a basic set of standard CSS styles for module templates would be nice.

    reply
  7. Super XOOPser December 26, 2011

    You’re a dick. Always was and always will be.

    reply
  8. Will December 28, 2011

    Why thank you Super XOOPser! I am so glad that you found my post informative and helpful. Also, thank you for representing your project in such a positive way.

    I am sure that you are a super talented person, who has everything in the world going for them. I feel honored that you would take time out of your busy day to comment on my little bloggity blog.

    Hugs and kisses <3
    - WIll

    reply

Leave a Reply