Menu with individual images

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Menu with individual images

Post 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??
User avatar
thomahawk
Power Poster
Power Poster
Posts: 293
Joined: Fri Jul 25, 2008 10:13 am
Location: Zug, Switzerland

Re: Menu with individual images

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Menu with individual images

Post 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 -->
Locked

Return to “The Lounge”