Insert content form a news article into another page

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.

Comments

  • 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.
  • acrylian Administrator, Developer
    `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.
  • 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 ...
  • 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.
  • gjr Member
    just guessing here:

    `
    $newsinsert = new ZenpageNews('insertyourtitlelink');
    echo $newsinsert->getContent();
    `
  • gjr Member
    same time sbillard...good to know I was right...lol
  • Thanks! Just needed examples which did the trick for me.
Sign In or Register to comment.