This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

How to add news along with files on the frontpage


avatar
cosmin 269
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
avatar
OP 269
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
avatar
Administrator
1342
From: 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
1 Re: How to add news along with files on the frontpage
avatar
OP 269
From: -
Switching back to the HTML tab has shrunk the text area and prevents resizing. Appears to be a problem with the HTML editor, switching between the two tabs causes weird results.
2012_04_23_181535
2012_04_23_181822
1 Re: How to add news along with files on the frontpage
avatar
OP 269
From: -
Just so you know I'm getting a script error on the textarea on the PHP tab. There is no scrollbar in firefox or IE and I can't see all the text I paste so I can edit it if I need to.
2012_04_23_181335
1 Re: How to add news along with files on the frontpage
avatar
Administrator
1342
From: 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:
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
avatar
OP 269
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
avatar
Administrator
1342
From: 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?

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.