dir argument for {content_image} not parsed before _display_image_block called

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
codegrunt
Forum Members
Forum Members
Posts: 12
Joined: Mon Oct 11, 2010 9:24 pm

dir argument for {content_image} not parsed before _display_image_block called

Post by codegrunt »

Howdy.  While trying to set up some templates to load images from a directory based on the current site section (as pulled from the menu manager via a custom tag), I have run into an issue with the admin template parser.

The problem is that at page edit time, the image list for {content_image} is loaded via the _display_image_block() method in "./lib/classes/contenttypes/Content.inc.php".  I am not sure where this is called from (I am new to this codebase) but the problem is that the "dir" argument is not parsed as other Smarty template vars are. 

This means that the following attempt to pass a dynamically generated directory name fails:

Code: Select all

{content_image block="image1" label="left image" dir="images/static/$mySectionAlias"}
The problem is that the _display_image_block() method is getting passed the literal string "images/static/$mySectionAlias" instead of the parsed value.  Anyone know whether what I am trying to do is impossible or is there a way to pass a dynamic value for the dir argument of {content_image}?  My goal is try to limit what images are presented to something specific to the site section without having to create a bunch of extra templates with hard-coded paths.

Any help appreciated.

Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: dir argument for {content_image} not parsed before _display_image_block called

Post by calguy1000 »

The admin does not use smarty to parse the page template to find content blocks.
it's done manually with grep.

The smarty stuff works on the frontend, not in the admin.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
codegrunt
Forum Members
Forum Members
Posts: 12
Joined: Mon Oct 11, 2010 9:24 pm

Re: dir argument for {content_image} not parsed before _display_image_block called

Post by codegrunt »

Ok, good to know that you can only pass static values to placeholders that control anything in the editor view. 

Do I need to open a bug report to get that into the documentation? 

Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
NaN

Re: dir argument for {content_image} not parsed before _display_image_block called

Post by NaN »

If you want dynamic values you can try the AdvancedContent module to display the content blocks. It processes smarty stuff also in backend. Read the module documentation for more info.
Post Reply

Return to “CMSMS Core”