Hello there!
When searching in the $gCms object (using print_r) for certain page related values i realized that the content object (this what contains the whole contents of a page) is contained 22 times in there.
That means my page content consumes 22 times more memory than it actually would need.
Just a simple question: Am i right or not? If i'm right, is this really neccessary?
$gCms Object contains the Content Object several times - wich is {$content_obj}?
$gCms Object contains the Content Object several times - wich is {$content_obj}?
Last edited by NaN on Sat Mar 13, 2010 9:17 pm, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: $gCms Object contains the Content Object 22 times?!?
It's correct.... and it's because you have 22 pages, or content items.
The content items are needed to build the navigation.... so we just keep em around incase other things need it like {cms_selflink} or {$cgsimple->get_page_conent(...)} etc, etc.
It's part of that trade off between SQL queries, and php memory.
The content items are needed to build the navigation.... so we just keep em around incase other things need it like {cms_selflink} or {$cgsimple->get_page_conent(...)} etc, etc.
It's part of that trade off between SQL queries, and php memory.
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.
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.
Re: $gCms Object - Wich is the one used in template {$content_obj}
Ah, okay.
Thanks for the quick and easy reply.
Is this what can be triggered by the load_props param in the {menu} tag?
I don't need the whole content 22 times.
Anyway... i need to know wich is the one that ist used by the template var {$content_obj}.
I'm creating a dynamic template that loops through the content props array and decide where to display what content block.
In brief:
I have several content blocks. For each content block i have additional content blocks with param oneline=true where the editor can enter "left", "right", "top" or "bottom".
In the template i have four areas that are styled to be shown on left, right, top or bottom side of the page.
In this areas i have a foreach loop that loopps trough the $content_obj->mProperties->mPropertyValues array and checks if the value of the content prop that holds the "position" is the one that belongs to the current div.
That works fine but the problem is that the contents in the array $content_obj->mProperties->mPropertyValues are not ordered in that way they are shown in the backend.
So the "main content" (content_en) may be shown as last content block or anywhere in the e.g. the left column.
But i want it always to be shown as first block. No matter in wich area it is shown.
I try to create a plugin that orders the contents that way i want it.
I just name the additional blocks content_en_layout, content2, content2_layout, content3, content3_layout, ... etc. so i can reorder them by the php function ksort($smarty->_tpl_vars['content_obj']->mPropertyValues) since the blocknames are used as the index.
But reordering the array $smarty->_tpl_vars['content_obj']->mPropertyValues doesn't change anything.
Even unset($smarty->_tpl_vars['content_obj']->mPropertyValues) does have any effect.
So this is why i believe the template var {$content_obj} must be one of the 21 other content arrays . . .
But wich one?
And is this always the same?
I know i could assign the reordered array to smarty and use in the template in the foreach loop the new assigned smarty variable.
But this will put another complete content array into memory, what isn't really necessary since it is already (22 times!) there.
I hope someone understands what i'm talking about, since english is not my native language.
EDIT: SOLVED
*lol* Figured it out
$smarty->_tpl_vars['content_obj']->mPropertyValues doesn't exist
i forgot the mProperties Object:
$smarty->_tpl_vars['content_obj']->mProperties->mPropertyValues
cheers
Thanks for the quick and easy reply.
Is this what can be triggered by the load_props param in the {menu} tag?
I don't need the whole content 22 times.
Anyway... i need to know wich is the one that ist used by the template var {$content_obj}.
I'm creating a dynamic template that loops through the content props array and decide where to display what content block.
In brief:
I have several content blocks. For each content block i have additional content blocks with param oneline=true where the editor can enter "left", "right", "top" or "bottom".
In the template i have four areas that are styled to be shown on left, right, top or bottom side of the page.
In this areas i have a foreach loop that loopps trough the $content_obj->mProperties->mPropertyValues array and checks if the value of the content prop that holds the "position" is the one that belongs to the current div.
That works fine but the problem is that the contents in the array $content_obj->mProperties->mPropertyValues are not ordered in that way they are shown in the backend.
So the "main content" (content_en) may be shown as last content block or anywhere in the e.g. the left column.
But i want it always to be shown as first block. No matter in wich area it is shown.
I try to create a plugin that orders the contents that way i want it.
I just name the additional blocks content_en_layout, content2, content2_layout, content3, content3_layout, ... etc. so i can reorder them by the php function ksort($smarty->_tpl_vars['content_obj']->mPropertyValues) since the blocknames are used as the index.
But reordering the array $smarty->_tpl_vars['content_obj']->mPropertyValues doesn't change anything.
Even unset($smarty->_tpl_vars['content_obj']->mPropertyValues) does have any effect.
So this is why i believe the template var {$content_obj} must be one of the 21 other content arrays . . .
But wich one?
And is this always the same?
I know i could assign the reordered array to smarty and use in the template in the foreach loop the new assigned smarty variable.
But this will put another complete content array into memory, what isn't really necessary since it is already (22 times!) there.
I hope someone understands what i'm talking about, since english is not my native language.
EDIT: SOLVED
*lol* Figured it out
$smarty->_tpl_vars['content_obj']->mPropertyValues doesn't exist

i forgot the mProperties Object:
$smarty->_tpl_vars['content_obj']->mProperties->mPropertyValues
cheers
Last edited by NaN on Sat Mar 13, 2010 9:53 pm, edited 1 time in total.