If you make a new page with specific content and then use something to pull that content into the 'Home' page wouldn't that be duplicate content to search bots like google..?
There isn't any way to do this built into the core but you can use a module to pull it, CGSimpleSmarty comes to mind but if it is a new page every time then you would have to change the {tag} every time...
I think it would be better to use a module like News to do this {news number='1'} will show the newest News article all the time automatically...
Display the content of the most recently created page?
Re: Display the content of the most recently created page?
i agree with the Dr, but for the sake of the exercise:
create a UDT "latestContent"
Then put this in your template:
Requirements:
1) CGSimpleSmarty
Limitations:
1) above code assumes there's only one content block on the page with the last modified time stamp
2) if you put the smarty code in a content area instead of a template you'll set the last_modified timestamp of that page and when looking at it you will get some sort of loop. i didnt try this but it cannot be good.
EDIT: I misread your question. the above uses modified date instead of creation date. change sql. ... ORDER BY create_date DESC LIMIT 1
in which case it should also work in content section as long as its not the last page created.
create a UDT "latestContent"
Code: Select all
$db = cmsms()->GetDb();
$smarty = cmsms()->GetSmarty();
//find latest content
$query = 'SELECT content_alias FROM '.cms_db_prefix().'content WHERE type = "content" AND active="1" ORDER BY modified_date DESC Limit 1';
$result1 = $db->Execute($query);
while ($result1 && $row = $result1->FetchRow()) {
$latestContent = $row['content_alias'];
}
//assign smarty variable
$smarty->assign('smartyLatestContent', $latestContent);
Code: Select all
{latestContent}
{$cgsimple->get_page_content("$smartyLatestContent",'','evalMe')}
{eval var=$evalMe}
1) CGSimpleSmarty
Limitations:
1) above code assumes there's only one content block on the page with the last modified time stamp
2) if you put the smarty code in a content area instead of a template you'll set the last_modified timestamp of that page and when looking at it you will get some sort of loop. i didnt try this but it cannot be good.
EDIT: I misread your question. the above uses modified date instead of creation date. change sql. ... ORDER BY create_date DESC LIMIT 1
in which case it should also work in content section as long as its not the last page created.