Custom info in site_header
Forma 17
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: Custom info in site_header
Keiretsu 0
From: -
From: -
Custom info in site_header
Thanks capslock
Thanks capslock
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
Thanks philipp, does exactly what i was after and no syntax errors this time hehe
Thanks philipp, does exactly what i was after and no syntax errors this time hehe
1 Re: Custom info in site_header
capslock 0
From: -
From: -
Custom info in site_header
For those who need it, this is the code to have last stories in custom menu header:
For those who need it, this is the code to have last stories in custom menu header:
If ((preg_match("/story/",$_SERVER['PHP_SELF'])) and ($_GET['id']))
{
$story_menu = "";
$id = checknum($_GET['id']);
dbconnect();
$query = DBQuery("SELECT story_category FROM esselbach_st_stories WHERE story_id = '$id'");
list($cat) = mysql_fetch_row($query);
//$query = DBQuery("SELECT story_category FROM esselbach_st_stories WHERE story_category = '$cat'");
//list($cat_name) = mysql_fetch_row($query);
$query = DBQuery("SELECT category_name FROM esselbach_st_categories WHERE category_id = '$cat'");
list($cat_name) = mysql_fetch_row($query);
$story_menu .= "Altre news della categoria $cat_name:<br>";
$query = DBQuery("SELECT * FROM esselbach_st_stories WHERE story_category = '$cat' ORDER BY story_time DESC LIMIT 10");
while($row = mysql_fetch_array($query))
{
$story_menu .= "<a href="https://www.contentteller.com/story.php?id=$row[story_id]">$row[story_title]</a><br />";
}
}
t
1 Re: Custom info in site_header
Philipp
From: Austria
Administrator
1342From: Austria
Custom info in site_header
and
where the headlines should appear.
This script is ignoring category 3 & 5:
I hope the SQL syntax is clear
dbconnect();
$news = "";
$olddate = "";
$query = DBQuery("SELECT * FROM esselbach_st_stories WHERE NOT(story_category = '3') AND NOT(story_category = '5') ORDER BY story_time DESC LIMIT 10");
while($data = mysql_fetch_array($query))
{
$newdate = date("jS F",strtotime($data['story_time']));
if ($olddate != $newdate)
{
if ($olddate) $news .= "<br />";
$news .= $newdate."<br />";
$olddate = $newdate;
}
$news .= "<a href="https://www.contentteller.com/story.php?id=".$data['story_id']."">".$data['story_title']." </a><br />";
}
and
$news
where the headlines should appear.
This script is ignoring category 3 & 5:
NOT(story_category = '3') AND NOT(story_category = '5')
I hope the SQL syntax is clear
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
Oh BTW, it would also be great if you added a bit of code which will allow me to swtch off specific categories from beig displayed. in this script.
For example, i may want to have a news category which is far more important than the other typical ones and so wouldn't want this news mixed in with the above script, i'd call this category somewhere else on the mian page while all other news categories would be called in the above script.
So basically i'd like the ability to switch off certain news categories in this script.
Oh BTW, it would also be great if you added a bit of code which will allow me to swtch off specific categories from beig displayed. in this script.
For example, i may want to have a news category which is far more important than the other typical ones and so wouldn't want this news mixed in with the above script, i'd call this category somewhere else on the mian page while all other news categories would be called in the above script.
So basically i'd like the ability to switch off certain news categories in this script.
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
I currently have a script which pulls the latest 10 headlines of news from a category, i was wondering if its possible to pull the latest 10 news headlines not from a cat but from all cats just like on the main page where it lists all news in chronological order?
I was also hoping that in this script, when news is posted from a different day it will divide stories with a header saying the date, like this:
25th August
Web Roundup: 6th Sept - INTEL Fragfest 2005 & Media Center
Web Roundup: 3rd Sept - X800GT & XBOX 360 in Detail
Web Review Roundup: 31st August - BenQ 5ms Monitor & PSU Goodness
24th August
ATI ALL-IN-WONDER X800 GT PCI Express
Three Reviews at CDRinfo
Web Review Roundup: 26th August - 'Cow in a Churn' Mod
Web Review Roundup: 25th August - OCZ PC3200 Gold Givaway
It's a shame the archive doesn't work in a way that i can pull all news stories for a specific day but perhaps ST2 with a calender fucntion, mentioned by Rushian?
Thanks,
I currently have a script which pulls the latest 10 headlines of news from a category, i was wondering if its possible to pull the latest 10 news headlines not from a cat but from all cats just like on the main page where it lists all news in chronological order?
I was also hoping that in this script, when news is posted from a different day it will divide stories with a header saying the date, like this:
25th August
Web Roundup: 6th Sept - INTEL Fragfest 2005 & Media Center
Web Roundup: 3rd Sept - X800GT & XBOX 360 in Detail
Web Review Roundup: 31st August - BenQ 5ms Monitor & PSU Goodness
24th August
ATI ALL-IN-WONDER X800 GT PCI Express
Three Reviews at CDRinfo
Web Review Roundup: 26th August - 'Cow in a Churn' Mod
Web Review Roundup: 25th August - OCZ PC3200 Gold Givaway
It's a shame the archive doesn't work in a way that i can pull all news stories for a specific day but perhaps ST2 with a calender fucntion, mentioned by Rushian?
Thanks,
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
Much appreciated, both scripts work perfectly. And thanks for the other help, too.
Much appreciated, both scripts work perfectly. And thanks for the other help, too.
1 Re: Custom info in site_header
Philipp
From: Austria
Administrator
1342From: Austria
Custom info in site_header
If ((preg_match("/review/",$_SERVER['PHP_SELF'])) and ($_GET['id']))
{
$review_menu = "";
$id = checknum($_GET['id']);
dbconnect();
$query = DBQuery("SELECT review_category FROM esselbach_st_review WHERE review_id = '$id'");
list($cat) = mysql_fetch_row($query);
$query = DBQuery("SELECT reviewcat_name FROM esselbach_st_reviewcat WHERE reviewcat_id = '$cat'");
list($cat_name) = mysql_fetch_row($query);
$review_menu .= "Category: $cat_name<br /><br />";
$query = DBQuery("SELECT * FROM esselbach_st_review WHERE review_category = '$cat' AND review_page = '1' ORDER BY review_date DESC LIMIT 10");
while($row = mysql_fetch_array($query))
{
$review_menu .= "<a href="https://www.contentteller.com/review.php?id=$row[review_id]">$row[review_title]</a><br />";
}
}
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
Could you do one small modification to this excellent script? Could you make it have a header that will display the category name? That would make it perfect for what i was after.
Could you do one small modification to this excellent script? Could you make it have a header that will display the category name? That would make it perfect for what i was after.
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
Works now, this is the best script ever! Really happy with this one.
Works now, this is the best script ever! Really happy with this one.
1 Re: Custom info in site_header
Philipp
From: Austria
Administrator
1342From: Austria
Custom info in site_header
I made a few typos
Here the updated script:
I made a few typos
Here the updated script:
If ((preg_match("/review/",$_SERVER['PHP_SELF'])) and ($_GET['id']))
{
$review_menu = "";
$id = checknum($_GET['id']);
dbconnect();
$query = DBQuery("SELECT review_category FROM esselbach_st_review WHERE review_id = '$id'");
list($cat) = mysql_fetch_row($query);
$query = DBQuery("SELECT * FROM esselbach_st_review WHERE review_category = '$cat' AND review_page = '1' ORDER BY review_date DESC LIMIT 10");
while($row = mysql_fetch_array($query))
{
$review_menu .= "<a href="https://www.contentteller.com/review.php?id=$row[review_id]">$row[review_title]</a><br />";
}
}
1 Re: Custom info in site_header
Forma
OP
17
From: -
From: -
Custom info in site_header
The review_menu script didn't work for me, it broke up me site_header a little. Any ideas?
The review_menu script didn't work for me, it broke up me site_header a little. Any ideas?
1 Re: Custom info in site_header
Philipp
From: Austria
Administrator
1342From: Austria
Custom info in site_header
To exclude a section (here poll):
You could add something like:
I'd like to call html code depending on what page is being viewed and in fact, i'd also like to know if there was a way to exclude html from certain pages so i can have say, the poll in the side bar, displayed on all pages unless i specifiy otherwise (mainly to stop the poll showing when on poll.php?idx.
To exclude a section (here poll):
If (!preg_match("/poll/",$_SERVER[PHP_SELF]))
{
...
}
For example, you view a review of a power supply and so the menu displays the last 10 power supply reviews (lets say its category 5)
You could add something like:
If ((preg_match("/review/",$_SERVER['PHP_SELF'])) and ($_GET['id']))
{
$review_menu = “”;
$id = checknum($id);
dbconnect();
$query = DBQuery(“SELECT review_category FROM esselbach_st_review WHERE review_id = ‘$id’”);
list($cat) = mysql_fetch_row($query);
$query = DBQuery(“SELECT * FROM esselbach_st_review WHERE review_cat = ‘$cat’ ORDER BY review_date DESC LIMIT 10”);
while($row = mysql_fetch_array($query))
{
$review_menu .= “<a href=”review.php?id=$row['review_id']”>$row['review_title']</a><br />”;
}
}
I'd like to call html code depending on what page is being viewed and in fact, i'd also like to know if there was a way to exclude html from certain pages so i can have say, the poll in the side bar, displayed on all pages unless i specifiy otherwise (mainly to stop the poll showing when on poll.php?idx.
I already know that to make code only show for a specific page like index you do the following:
then put $review_menu anywhere you want to call that code.
FIrstly i'd like to know how make a menu that will display the latest reviews in a specific category so i can call this up and display different categories as and when a review page is viewed of the same category.
For example, you view a review of a power supply and so the menu displays the last 10 power supply reviews (lets say its category 5)
Thanks Philipp.