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

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [solved] help learning how to access any value of content object
PostPosted: Tue Nov 16, 2010 3:08 pm 
Offline
Power Poster
Power Poster

Joined: Mon Oct 20, 2008 6:07 pm
Posts: 280
Sup peeps,
I got awesome feedback from you guys on how to access the extra1 field with the content_obj, which works great with mPropertyTypes values!

\$1:
$getfield = $content_obj->GetPropertyValue('extra1');


But now that I look at the entire object, is there "a way" that I can learn how to access any array value of the object?  For example, I want to access the mName (which I assume is the title of the content page?).  So I did this...

\$1:
$content_obj = $smarty->get_template_vars('content_obj');
$getname = $content_obj->GetPropertyValue('mName');

print 'the title of the page is: '.$getname;


But it didn't work.  I'm willing to learn!

Thanks


Last edited by blackhawk on Tue Nov 16, 2010 5:28 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: help learning how to access any value of content object
PostPosted: Tue Nov 16, 2010 4:18 pm 
Don't use the 'm-variables'.
They are private vars that are not accessible from 'outside' of the content-object context.
You cannot access them in CMSms 1.9 anymore.

Every content has some base properties (like title, alias, menutext ... the 'm-variables')
These base properties cannot be accessed using the GetPropertyValue() function.
The GetPropertyValue() function is only to get content type related property values.
(like contentblocks, extra fields ... stuff that only belongs to certain content types)

The base properties are defined in a ContentBase object that is extended by all other content types.
For almost each base property there is a public function that will return the value of that property.

Examples:

Title:
Wrong: $content_obj->mName
Right: $content_obj->Name()

Alias:
Wrong: $content_obj->mAlias
Right: $content_obj->Alias()

and so on.

Here is a full documentation of the contentbase object:
http://www.cmsmadesimple.org/apidoc/CMS ... tBase.html


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: help learning how to access any value of content object
PostPosted: Tue Nov 16, 2010 5:27 pm 
Offline
Power Poster
Power Poster

Joined: Mon Oct 20, 2008 6:07 pm
Posts: 280
sweet!!! thanks NaN


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

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:  
A2 Hosting