OXID Community Forum> How to create a News Detail Page |
Login |
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Reply |
|
|
Thread Tools | Display Modes |
|
Hallo all,
I added a lot of fields to the news in the backend. Now the news should be shown in a list view and in a detail view. The list view works in oxid per default (tpl/page/info/news.tpl). but now i also need a template news_detail.tpl to show just the details of a single news... Basically I wonder how I create the links that will open then the detail page and I have to send a parameter (the ID of the news to be shown). Is there any further configuration needed? Kind regards, Florian |
|||
|
hey vanilla thunder,
thank you that worked quite well so far. I´ve created /views/newsdetail.php and /out/mytemplate/tpl/page/info/newsdetail.tpl In newsdetail.php I´ve put a function that does the db-request and returns an news object with all the properties that I need: Code:
public function getNewsById($id){
$oDB = oxDb::getDb(true);
$query = "SELECT * FROM oxnews WHERE oxid = '" .$id."'";
$row = $oDB->Execute( $query );
$news = new stdClass();
$news->titel = $row->fields["OXSHORTDESC"];
$news->datum = $row->fields["OXDATE"];
return $news;
}
[{assign var="nid" value=$smarty.get.nid}] [{assign var="news" value=$oView->getNewsById($nid)}] [{$news->titel}] and finally the link to call the detail site looks like that: [{assign var="nid" value=$oNews->oxnews__oxid->value}] <a href="[{ $oViewConf->getSelfLink()|oxaddparams:"nid=$nid&cl=newsde tail" }]">Weiterlesen</a> Kind regards, Florian |
|||
|
Hello,...
I found a little problem... the BreadCrumb does not work properly - contains just one link and it is wrong... So far I have in newsdetail.php the same Breadcrumb function as in news.php: Code:
public function getBreadCrumb()
{
$aPaths = array();
$aPath = array();
$aPath['title'] = oxLang::getInstance()->translateString( 'PAGE_INFO_NEWS_TITLE', oxLang::getInstance()->getBaseLanguage(), false );
$aPath['link'] = $this->getLink();
$aPaths[] = $aPath;
return $aPaths;
}
}
Many thx, Florian |
|||
|
i guess the bredcrub's title is "nuigkeiten" and it points to the general news page, right?
the coolest way would be to fit PHP Code:
$aPath['title'] might be something like $news->titel |
||||
| Reply |
| Bookmarks |
| Tags |
| create, news, page, template |
| Thread Tools | |
| Display Modes | |
|
Nicht Sichtbar
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can't create a country | ferclaverino | Installation and configuration | 10 | 04-18-2012 08:58 PM |
| Several pages for "news" section. (The locator-navigation for "news" section). | v_h | Developers | 2 | 02-13-2012 07:27 AM |
| how to display 2 news items in start page | workingprojectss | Developers | 2 | 07-06-2010 12:00 PM |
| How to edit product detail and catalog detail | boongui | Newbies | 3 | 06-11-2010 04:24 PM |
| Product Detail Page | LSobanski | Product presentation | 8 | 02-09-2010 11:55 AM |