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.
Not a member yet? Click here to register.
Forgot Password?

SCROLLING FEATURED NEWS PANEL

Asked Modified Viewed 6,012 times
K
Kevin Maschke
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
asked
Member

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":


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


Defaults:


width='496' height='250'



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


WHERE news_cat=11


IT APPEARS 11 TIMES!

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


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:


$(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
Edited by Kevin Maschke on 02-08-2011 20:29,
Kevin Maschke attached the following file:
featured_news_panel.rar [No information available / 509 Downloads]
0 replies

Poll: What do you think?

    Great! [4/7]57 %
    Ugly... [3/7]43 %

9 posts

M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

There is quite some duplicate code in there. Try using a loop (for/while/foreach) instead. Still good for your first one ;-)
0 replies
K
Kevin Maschke
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

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
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

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]
0 replies
K
Kevin Maschke
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

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.
0 replies
M
Matonor
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

Did you keep those javascript includes at the top? I just altered the lower part.
0 replies
K
Kevin Maschke
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

Yes, I just replaced what you posted.

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


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


and in CSS:


#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?
Edited by Kevin Maschke on 04-08-2011 13:38,
0 replies
— 2 months later —
O
overmix
O
  • Junior Member, joined since
  • Contributed 10 posts on the community forums.
  • Started 2 threads in the forums
answered
Junior Member

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?
Edited by overmix on 24-10-2011 21:07,
0 replies
— 2 years later —
S
smart jackpot
S
  • Newbie, joined since
  • Contributed 1 post on the community forums.
answered
Newbie

any demo site or sample ?
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Try to change both java and CSS selector.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 9 posts
  • Votes 0 votes
  • Topic users 5 members

5 participants

M
M
Impossible things are there to be made possible
  • Veteran Member, joined since
  • Contributed 1,022 posts on the community forums.
  • Started 3 threads in the forums
K
K
<3 PHP-Fusion
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
O
O
  • Junior Member, joined since
  • Contributed 10 posts on the community forums.
  • Started 2 threads in the forums
S
S
  • Newbie, joined since
  • Contributed 1 post on the community forums.

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet