Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

SCROLLING FEATURED NEWS PANEL

I recently tried to mod the orbit panel to show latest news images. But then I saw the Myslide Panel-Center made by HaYaLeT and I decided to mod that one.

This panel does basically the same as the original one, it shows latest 10 images in a small slideshow. But instead the last 10 photos from photogallery it shows the last 10 news_images uploaded while creating a news item, linking to the respective news readmore page.

DEMO: http://www.km.hostei.com/php-fusion/news.php

To make this work correctly, you must edit in "Admin Panel > Settings > News" the "Maximum photo size" to the same or more specified in the "featured_news_panel.php":

CodeDownload  

echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='496' height='250' alt='".$data['news_subject']."' title='".$data['news_subject']."' /></a> ";



Defaults:

CodeDownload  

width='496' height='250'




To edit the category from which to display news_images, edit:

CodeDownload  

WHERE news_cat=11



IT APPEARS 11 TIMES!

You can also (optional) change the size of the thumbs by editing:

CodeDownload  

echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='38' height='30' alt='".$data['news_subject']."' title='".$data['news_subject']."' />"; }



And the time to wait for the image to change and the slide speed by changing:

CodeDownload  

$(currentImage).fadeOut(400, function() {
                   myTimer = setTimeout("showNext()", 4000);




I hope you like it!
Remember, I did not code this. I just modded it to show news!

P.D, If anyone could tell me how to make that to change the news_category it would just be enough to edit one time "WHERE news_cat=11". Don't know, some variable to include as "$cat" in de SQL Query. This would do things a lot easier :D
Kevin Maschke attached the following file:
featured_news_panel.rar [2.84kB / 468 Downloads]
There is quite some duplicate code in there. Try using a loop (for/while/foreach) instead. Still good for your first one ;-)

Quote

Matonor wrote:

There is quite some duplicate code in there. Try using a loop (for/while/foreach) instead. Still good for your first one ;-)


Hi! thanks for your comment.

I tried this:


[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]while($catnum=11){
$cat='WHERE news_cat=".$catnum."';
}[/syntaxhighlighter]

And used ".$cat." in all SQL queries. So user would just need to change one time. But this did not work.
I've read the php manual of "for, while and foreach" but I do not understand them right... I'll keep looking for it, but if you could indicate me somehow the right path, that would be great smile
Take a look at this, it should do the same your script did except it does it with proper loop usage and thus less code. I didn't test it though, so there might be errors ;-)

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]opentable($locale['featured001']);

echo "<table cellpadding='0' cellspacing='0' align='center'>\n<tr>\n<td>\n";
echo"<div id='wrapper'>";

$result=dbquery(
"SELECT * FROM ".$db_prefix."news ta ".
"WHERE news_cat=11 ORDER BY news_id DESC LIMIT 0,11"wink;

if (dbrows($result)!= "0"wink {
$data = dbarray($result);
echo "<div id='bigPic'>";
echo " <a href='".FUSION_SELF."?readmore=".$data['news_id']."'>";
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='496' height='250' alt='".$data['news_subject']."' title='".$data['news_subject']."' /></a> ";
echo "</div>";
echo "<ul id='thumbs'>";
$i=1;
while($data = dbarray($result)) {
echo "<li class='active' rel='".($i++)."' >";
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='38' height='30' alt='".$data['news_subject']."' title='".$data['news_subject']."' />";
echo"</li>";
}

echo "</ul>";
} else {
echo $locale['featured002'];
}

echo "</div>";
echo "</td>\n</tr>\n</table>\n";
closetable();[/syntaxhighlighter]

Quote

Matonor wrote:

Take a look at this, it should do the same your script did except it does it with proper loop usage and thus less code. I didn't test it though, so there might be errors ;-)

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]opentable($locale['featured001']);

echo "<table cellpadding='0' cellspacing='0' align='center'>\n<tr>\n<td>\n";
echo"<div id='wrapper'>";

$result=dbquery(
"SELECT * FROM ".$db_prefix."news ta ".
"WHERE news_cat=11 ORDER BY news_id DESC LIMIT 0,11");

if (dbrows($result)!= "0") {
$data = dbarray($result);
echo "<div id='bigPic'>";
echo " <a href='".FUSION_SELF."?readmore=".$data['news_id']."'>";
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='496' height='250' alt='".$data['news_subject']."' title='".$data['news_subject']."' /></a> ";
echo "</div>";
echo "<ul id='thumbs'>";
$i=1;
while($data = dbarray($result)) {
echo "<li class='active' rel='".($i++)."' >";
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='38' height='30' alt='".$data['news_subject']."' title='".$data['news_subject']."' />";
echo"</li>";
}

echo "</ul>";
} else {
echo $locale['featured002'];
}

echo "</div>";
echo "</td>\n</tr>\n</table>\n";
closetable();[/syntaxhighlighter]


I've tested it. It displays the panel right. But the images do not scroll and clicking on the thumbs does also not change anything.
Did you keep those javascript includes at the top? I just altered the lower part.
Yes, I just replaced what you posted.

P.D, by the way, I added after bigpic:

CodeDownload  

echo " <h2><span>".$data['news_subject']."</span></h2>\n";



and in CSS:

CodeDownload  

#bigpic h2 {
   position: absolute;
   top: 150px;
   left: 0;
   width: 496px;
   padding: 0 5px;
}

#bigpic h2 span {
   color: white;
   font: bold 24px/45px Helvetica, Sans-Serif;
   letter-spacing: -1px;
   background: rgb(0, 0, 0); /* fallback color */
   background: rgba(0, 0, 0, 0.7);
   padding: 10px;
}



So normally over the big image should appear the news subject in h2 size. But nothing appears...

Merged on Aug 04 2011 at 12:38:07:
Any idea?
Let me give you a tested and modified in the post result soon

Merged on Oct 24 2011 at 17:06:29:

The friend made &#8203;&#8203;any tutorial on that jquery login at the top as your site?

That there is also a good change

If you did can post the link?
any demo site or sample ?
Try to change both java and CSS selector.
Thread Information
Author
Replies
10 posts
Views
5,240 times
Last Post
Last updated on 6 years ago

Poll: What do you think?

    Great!57%
    %
    Ugly...43%
    %
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot edit the poll in this discussion thread.
You cannot vote on the poll in this discussion thread.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Matonor, Kevin Maschke, Chan, overmix, smart jackpot