Member
Member
NaturalEnquirer   2011-07-23, 20:29
#1
I am using the printPageContent function within a printCodeBlock to insert the contents of a specific page into another page by using the page's titlelink.

Is there an equivalent function for inserting content from a news article using its titlelink?

I looked in the functions list but only saw printNewsContent which doesn't seem to do the same thing.

I apologize if I overlooked a function.

Thank you.
Member
Member
sbillard   2011-07-23, 21:01
#2
There is `printNewsContent()` which is the equivalent function. However, I doubt that this will work for you. Both these functions are "context" sensitive--that is `printPageContent()` will print the content of the current page and `printNewsContent()` will print the content of the current news article. It is not likely that there will be both a news article and a page as the "current context".

From within a codeblock you should be using object methods to refeence specific items. You can use `echo $obj->getContent();` to print the content of a the object in question.
Administrator
Administrator
acrylian   2011-07-24, 07:55
#3
`printPageContent()` lets you indeed get any page's content directly without pageg context. That is a feature from the beginning of Zenpage before we improved the object model greatly and is actually an "unnecessary" feature now therefore. Just to add.
Member
Member
NaturalEnquirer   2011-07-24, 16:14
#4
I am photographer with rudimentary programming skills ... I can understand how to use the printPageContent('titlelink') function and how to echo content of a current page but don't know how I would load a specific article / page. Any way someone could give basic example of using $obj->getContent();?

I can make do with using the printPageContent('titlelink') so hope that you don't remove that function for us non-programmers ...
Member
Member
sbillard   2011-07-24, 16:47
#5
The equivalent object model code for `printPageContent($titlelink);` would be `$obj = new ZenpagePage($titlelink);echo $obj->getContent();`

Substitute `ZenpageNews` for `ZenpagePage` and you will print the content of a specific news article.
Member
Member
gjr   2011-07-24, 16:48
#6
just guessing here:

`
$newsinsert = new ZenpageNews('insertyourtitlelink');
echo $newsinsert->getContent();
`
Member
Member
gjr   2011-07-24, 16:49
#7
same time sbillard...good to know I was right...lol
Member
Member
NaturalEnquirer   2011-07-25, 16:37
#8
Thanks! Just needed examples which did the trick for me.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.