Page 2 of 2

Re: Menu with individual images

Posted: Tue Mar 01, 2016 12:43 pm
by velden

Code: Select all

{if !empty($node->image)}{else}<img src="{$node->image}" />{/if}
If NOT empty do nothing, else display the (empty) info??

Re: Menu with individual images

Posted: Tue Mar 01, 2016 1:37 pm
by thomahawk
Like I said, obviously it takes the if part, nevertheless there is an image present in {page_image}, so ($node->image) can not be empty. Except I understand it wrong like I wrote in the last post.

Re: Menu with individual images

Posted: Tue Mar 01, 2016 3:25 pm
by velden
Tested for you on 1.12.1:

PAGE template:

Code: Select all

...
{menu}
...
MENU template:

Code: Select all

...
{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
<!-- {$node|print_r} -->
{if $node->depth > $node->prevdepth}
...
Options tab page content:
cmsms_extra_image_values.JPG
Result in page source:

Code: Select all

...<!-- stdClass Object
(
    [id] => 15
    [pagetitle] => Home
    [url] => http://[removed]/cmsms1x/
    [accesskey] => 1
    [type] => content
    [tabindex] => 
    [titleattribute] => Home Page, shortcut key=1
    [modified] => 1456845337
    [created] => 1153855351
    [hierarchy] => 1
    [haschildren] => 
    [default] => 1
    [depth] => 1
    [prevdepth] => 1
    [children_exist] => 
    [menutext] => Home
    [raw_menutext] => Home
    [target] => 
    [index] => 0
    [alias] => home
    [parent] => 
    [extra1] => extra 1 value
    [extra2] => extra 2 value
    [extra3] => extra 3 value
    [image] => http://[removed]/cmsms1x/uploads/images/logo1.gif
    [thumbnail] => http://[removed]/cmsms1x/uploads/images/thumb_logo1.gif
    [current] => 1
    [first] => 1
)
1 -->
...
Note that image and thumbnail only appear to exist when they actually have a value for the specific page.

If using 'loadprops=0' some properties will not be available:

Code: Select all

<!-- 
stdClass Object
(
    [id] => 15
    [pagetitle] => Home
    [url] => http://[removed]/cmsms1x/
    [accesskey] => 1
    [type] => content
    [tabindex] => 
    [titleattribute] => Home Page, shortcut key=1
    [modified] => 1456845337
    [created] => 1153855351
    [hierarchy] => 1
    [haschildren] => 
    [default] => 1
    [depth] => 1
    [prevdepth] => 1
    [children_exist] => 
    [menutext] => Home
    [raw_menutext] => Home
    [target] => 
    [index] => 0
    [alias] => home
    [parent] => 
    [current] => 1
    [first] => 1
)
1 -->