How to add news along with files on the frontpage
cosmin 269
From: -
From: -
Right now it's either one or the other.
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: How to add news along with files on the frontpage
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Now that's an odd bug. I was able to reproduce it on another installation but it works fine on my local installation. Both with the same browers http://www.contentteller.com/forums/styles/default/xenforo/smilies/confused.png
1 Re: How to add news along with files on the frontpage
cosmin
OP
269
From: -
From: -
It may be something related to my browser. I am now on IE8, because I reinstalled my Vista, you're using a Mac if I remember correctly.
1 Re: How to add news along with files on the frontpage
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Work fine here on my installation in both Firefox and Chrome. I can take a look if you send me a login.
The enhanced editor can be also disabled under Templates Settings
The enhanced editor can be also disabled under Templates Settings
1 Re: How to add news along with files on the frontpage
cosmin
OP
269
From: -
From: -
1 Re: How to add news along with files on the frontpage
cosmin
OP
269
From: -
From: -
1 Re: How to add news along with files on the frontpage
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
Here a quick modification. Open template files_layout_main in the template editor and add {$news} between {$insert['files_featured']} and {$insert['files_pagenav']}
Now switch over to the PHP part (PHP tab) and add the following:
and then save the template.
Now switch over to the PHP part (PHP tab) and add the following:
global $database;
$number_of_stories = 4;
$result = $database -> dbquery( "SELECT newsstory_id, newsstory_author, newsstory_channels, newsstory_title, newsstory_seo, newsstory_story, newsstory_extendedstory, newsstory_link, newsstory_tags, newsstory_teaser, newsstory_comments, newsstory_thread, newsstory_date, newsstory_fields, newsstory_views, newsstory_rating, newsstory_votes, newsstory_source, newsstory_sourceid, newsstory_sticky FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE (newsstory_status = '0' OR newsstory_status = '3') AND newsstory_frontpage = '1' ORDER BY newsstory_position DESC, newsstory_date DESC LIMIT " . $number_of_stories );
$news = "<br /><h6>Latest Stories</h6><br />";
while( list( $newsstory_id, $newsstory_author, $newsstory_channels, $newsstory_title, $newsstory_seo, $newsstory_story, $newsstory_extendedstory, $newsstory_link, $newsstory_tags, $newsstory_teaser, $newsstory_comments, $newsstory_thread, $newsstory_date, $newsstory_fields, $newsstory_views, $newsstory_rating, $newsstory_votes, $newsstory_source, $newsstory_sourceid, $newsstory_sticky ) = $database -> dbrow( $result ) )
{
$this_Teaser = ( $newsstory_teaser ) ? "<div><img src=\"news/teaserimage/" . $newsstory_teaser . " class=\"teaser\" alt=\"\" /></div>" : "";
$news .= "<h1>" . $newsstory_title . "</h1><h2>Posted by: " . $newsstory_author . " on: " . $newsstory_date . "<div class=\"content\">" . $this_teaser . "<div class=\"votes\"><a href=\"news/dorate/" . $newsstory_id . "\">" . $newsstory_votes . "<br />Vote</a></div>" . $newsstory_story . "<br /><br />" . "<a href=\"news/story/". $newsstory_seo . ".html\">Read more</a></div>";
}
$news .= "<br /><br /><div style=\"text-align: center;\"><a href=\"news/\">Click here to view the latest news stories</a></div>";
and then save the template.
1 Re: How to add news along with files on the frontpage
cosmin
OP
269
From: -
From: -
This is a bit tricky
I'll say... No offense, but you really need to rethink your template system. Aside from having a huge number of files (1705 with all modules installed!), I haven't seen many scripts that require you to write PHP code just to display the content of two different modules on the frontpage. It's really not pleasant having to come to the developer every time I need a change, and constantly being told "I'll look into it" and then have to wait for who knows how long and wait for the next version.
Where do you want that the news stories appear? Between featured and current files?
Yes, I guess so.
1 Re: How to add news along with files on the frontpage
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
This is a bit tricky. The probably easiest way is adding a PHP script in template files_layout_main to show the latest news stories.
Where do you want that the news stories appear? Between featured and current files?
Where do you want that the news stories appear? Between featured and current files?