21294 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 667 Views |
-
renderWith() problem

16 July 2010 at 2:38am Last edited: 16 July 2010 2:48am
Hi!
I have two php page and relative template.ss
ArticlePage.php
ArticlePage.ss
HomePage.php
HomePage.ssI want create in my HomePage.ss a box ( div a) and put here ArticlePage.ss (div b). so I want put inside div a, my div b (here I have the result of a function). I use renderWith() function but I see nothing..help please to correct code..
class ArticlePage extends Page {
public static $db = array();
public static $has_one = array();
}class ArticlePage_Controller extends Page_Controller {
function ArticleList() {
require_once('function.php');
$_return_article=articlePhp();
return $_return_article;}}
ArticlePage.ss
<div class="b">$ArticleList</div>
HomePage.php
class HomePage extends Page {
public static $db = array();
public static $has_one = array();
}class HomePage_Controller extends Page_Controller {
function ShowArticleTemplateList() {
return $this->renderWith('ArticlePage');}}
HomePage.ss
<div class="a">$ShowArticleTemplateList</div>
-
Re: renderWith() problem

19 July 2010 at 1:43am
hmmmm - I would have moved the "shared" article page into an "include" template ss (e.g. templates/Includes/ArticleLayout.ss)
and then use the template include on both the homepage and the article page...<% include ArticleLayout %>
Hope this helps
Barry
-
Re: renderWith() problem

20 July 2010 at 4:20am
I I use include, in my template i need do define a function that is the same for HomePage.php and articlePage.php So Imust repeat the same function in both php controller?
-
Re: renderWith() problem

20 July 2010 at 4:23am
no no - you have several options, the two that come to my mind are...
1)define it in Page.php
2)extend Page.php to ArctileHolderPage.php (or similar name), then extend your article page and home page from that -
Re: renderWith() problem

20 July 2010 at 8:08pm
Thanks!!You help me to find the correct solution!!thank you very much!!
| 667 Views | ||
|
Page:
1
|
Go to Top |


