Page 1 of 1

Need help combining menu and global content blocks [solved]

Posted: Wed May 14, 2008 3:38 pm
by dwinters
I need to find a way of ordering content bocks in a page - so that users can move them up and down easily

I thought the best way would be to use the menu system to get an order - and let users move them up and down
and global content blocks - of the same name as the pages - for holding the content.

I Tried this

{if $count > 0}
{foreach from=$nodelist item=node}

{global_content name='{$node->menutext}'}

{if $count > ($node->index+1)} |
{/if}
{/foreach}
{/if}


Got this error

Catchable fatal error: Object of class stdClass could not be converted to string in /var/www/vhosts/monkrat.com/httpdocs/services/tmp/templates_c/1cbb26175b950de6f53144e149baf403^%%F4^F42^F4233A79%%module_db_tpl%3AMenuManager%3Bsimple.php on line 10


So I am guessing  that nesting {} tags is out? How else can I do this?

Thanks

Dan

Re: Need help combining menu and global content blocks

Posted: Wed May 14, 2008 5:32 pm
by Pierre M.
You can't nest smarty {}.
There is another thread in the forum suggesting a client side DOM reordering using javascript.

Pierre M.

Re: Need help combining menu and global content blocks

Posted: Wed May 14, 2008 5:40 pm
by dwinters
Good to know I can't nest stops me banging my head with that one!

Can i declare and use like assign $boo ={$node->menutext}

then

{global_content name='$boo'}

Yes I read the javascript - that but thought they were suggesting a reorder by the viewer?

I need a cmsms user to be able to log in and change the order of a pages content blocks without having to copy and paste every bit of text 20 times to move position 19 -> position 2 and the rest down one in one page with 20 content blocks.

Could this javascript work in the admin area to reorder the content - I didnt see how.

Thanks

Dan

Re: Need help combining menu and global content blocks

Posted: Wed May 14, 2008 6:04 pm
by Pierre M.
dwinters wrote: Can i declare and use like assign $boo ={$node->menutext}
Search for capture and assign in Calguy's posts.
dwinters wrote: then  {global_content name='$boo'}
I don't think content blocks are *that* dynamic. Remember they are stored in the db.
dwinters wrote: Yes I read the javascript - that but thought they were suggesting a reorder by the viewer?
So you have read too that you are trying to make something CMSms is not designed for.

Pierre M.

Re: Need help combining menu and global content blocks [solved]

Posted: Sun May 18, 2008 5:42 pm
by dwinters
Thanks for the pointers guys!

Did it a sweet bit of simple code in the menu to use the menu to order content blocks based on page order - and have one page as a child to the calling page for each piece of content.

Great for league tables - or any list where things change up and down, hope this helps... My first contribution back to the team!

Make a menu containing ->

{if $count > 0}
{foreach from=$nodelist item=node}

{capture assign='m_alias'}{$node->alias}{/capture}

{$cgsimple->get_page_content($m_alias)}

{/foreach}
{/if}

Then a Parent page containing

{menu template="whatever_you_called_the_menu" start_level="2"}

And create a pages as a children of the calling page for each piece of content you require - then order then on the page using the up down of the menu.

Let me know if anyone finds this useful -- cheers

Dan