• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Menu with individual images
PostPosted: Sun Oct 04, 2015 9:29 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
Hello all

Is there a way to set individual images to each page and display it in the menu list?

Thom


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sun Oct 04, 2015 7:15 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12657
Location: Arizona
I set the page image in site admin > general settings to a folder in uploads/images that holds my menu images then when making pages that need them I go to options > image and select the image for that page, in the menu I add...

{if !empty($node->image)}<img src="{$node->image}" alt="{$node->menutext}" />{else}<span class='{$node->alias}'>{$node->menutext}</span>{/if}

This way if it doesn't have an image it shows the menu text...

[NOT TESTED IN 2.0]

_________________
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
Image


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sun Oct 04, 2015 7:36 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
Hi Dr. CSS
Thanks for that input. I will try this and as I already set page images for on top of the page, I only need to put in the menu code. Great!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sun Oct 04, 2015 9:17 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
actually my image is a content_image, but this does not work

{if !empty($node->content_image)}<img src="{$node->content_image}" />{else}{/if}

Not possible?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sat Oct 17, 2015 4:58 am 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12657
Location: Arizona
Because that isn't available for the menu manager, to access images in the menu manager you need to use what I showed...

_________________
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
Image


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sat Oct 17, 2015 3:16 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3085
Location: The Netherlands
It is possible but less efficient than $node->image.

For CMSMS 2.0 check help of the (by default) available page_attribute tag.

For CMSMS 1.x:

Module CGSimpleSmarty provides a method:

Quote:
get_page_content($alias[,$block][,$assign])

Returns the text of a specific content block of another page.

Arguments:

$alias - The page alias to extract content from.
[$block] - (optional) The name of the content block in the specified page. If this variable is not specified the value of the default content block (content_en) is assumed.
[$assign] - (optional) The name of a variable to assign the results to.


Example:

The 'second' block of the 'about' page is {cgsimple::get_page_content('about','second','foo')}{eval var=$foo}


so something like:

Code:
...
{cgsimple::get_page_content($node->alias,'my_image_blockname','tmpImg')}
{if !empty($tmpImg)} 
   ...do useful things here...
{/if}
...


Much less efficient because it has to create a Content Object for every
single page in the menu to get the image information if any.

Didn't test code above btw. Might need to check for specific content types before calling method (Separator, Section Header etc don't have custom content blocks)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sat Oct 17, 2015 4:10 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
Thanks you. In that case I try to switch the main image of each page over to use the option - image and use the same for the menu image. I will post here if it worked.

Thanks again
Thom


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sat Oct 17, 2015 5:55 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3085
Location: The Netherlands
Note that you can move that field to the main tab of the edit content page.

Global Settings -> Content Editing Settings -> 'Basic Properties' (multi select box).


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Sun Jan 10, 2016 1:20 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
Thanks for the suggestion.

Unfortunately it does not work.

I have set the image folder in "Administration > Global Setting" and changed the template to include {$node->image} instead of content_image, so the code is:

<div class="produkte-topbild" style="background-image:url({$node->image})">

I also changed the code for the menu to include {$node->image}.

It works as far as on editing the page, my list of images appears for the "image" tag and I selected the image for that page. But in the end, the image does not show on the page or with the menu. Checking the page sourcecode the result is:

<div class="produkte-topbild" style="background-image:url()">

So, no url is included, it is empty.
What did I do wrong?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Mon Jan 11, 2016 6:56 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 12657
Location: Arizona
The other post sounded like the image was going to be used in the menu now it sounds like it is going to be in the template as background image, $node->image only works in the menu manager the other image call, content_image is available for things like background...

_________________
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
Image


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Mon Jan 11, 2016 7:18 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
Hi Dr. CSS. Thanks for your post. Yes I supposed there may be yet again a limitation for that tag (how many times those tag limitations destroyed my plans – I quit counting). In fact I need the same {$node->image} once in template, once in menu and I tried both, its not working either way.

Thom


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Wed Jan 13, 2016 11:25 am 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3085
Location: The Netherlands
What version of CMSMS are we talking about?

Quote:
Yes I supposed there may be yet again a limitation for that tag (how many times those tag limitations destroyed my plans – I quit counting)


The only limitation is your own imagination ;-)

$node->image in Menu Manager
{page_image} tag in page template

Quote:
Help for the page_image tag
What does this do?

This tag can be used to return the value of the image or thumbnail fields of a certain page.
How do I use it?

Insert the tag into the template like: {page_image}.
What parameters does it take?

thumbnail - Optionally display the value of the thumbnail property instead of the image property.
(optional) assign (string) - Assign the results to a smarty variable with that name.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Thu Jan 14, 2016 4:56 pm 
Offline
Power Poster
Power Poster

Joined: Mon Jan 21, 2008 5:51 pm
Posts: 961
Location: MI
In the old MenuManager there was a parameter on whether or not to load all the page attributes into the $node object. Read the help, that might be the issue.

I don't know if this is still the case in 2.x with Navigator..


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Tue Mar 01, 2016 8:49 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
General info: I am using CMSMS 1.12

Thanks Jeff. In fact it is the opposite. the menu option you mean is loadprops but it is on by default and does only prevent things like $node->image to be loaded if it is specifically set to loadprops="0"

This is not the case in my menu setting.

My images are showing fine on the pages using this in the template
style="background-image:url(uploads/produkte-titelbilder/{page_image})"

but within the menu they do not show up. This is my menu manager code
{if !empty($node->image)}{else}<img src="{$node->image}" />{/if}
<a class="produkt" href="{$node->url}">{$node->menutext}</a>

The resulting html code does only include the page link, no image tag. So it seems as the menu manager sees node->image as empty.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Menu with individual images
PostPosted: Tue Mar 01, 2016 9:06 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jul 25, 2008 10:13 am
Posts: 289
Location: Zug, Switzerland
Unless I don't understand it right?

With {page_image} on a template, I get a field on the page editor to set an image from the folder (as set in admin–global settings).

This is the same image that the menu manager displays by using ($node->image), right?


By the way: I checked variables using {get_template_vars} I don't see any "image" variable on the page. Nevertheless the image shows up fine on that page.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting