رفتن به مطلب

نمایش پشت سرهم لینک آخرین مطالب "بالای سایتهای خبری"


پست های پیشنهاد شده

چنین افزونه یا کدی وجود داره که عنوان آخرین مطالب (مثلا 10 خبر آخر) در بالای سایت تایپ میشه و بعد چند ثانیه خبر بعدی ، مثل این سایت (آخرین خبرها) که با wp هست و سایتهای خبری؟

لینک به ارسال

چنین افزونه یا کدی وجود داره که عنوان آخرین مطالب (مثلا 10 خبر آخر) در بالای سایت تایپ میشه و بعد چند ثانیه خبر بعدی ، مثل این سایت (آخرین خبرها) که با wp هست و سایتهای خبری؟

سلام

این مورد چندید بار در انجمن مطرح شده

1. یک صفحه در قالبتون بسازید به نام news.php

این کدها رو هم بگذارید توش

<?php ?>
<script>
// CREDITS:
// Newsticker
// By Peter Gehrig
// Copyright © 2010 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at [url="http://www.fabulant.com"]http://www.fabulant.com[/url]
// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// [url="http://www.fabulant.com"]http://www.fabulant.com[/url] on the webpage
// where this script will be featured
var text=new Array()
var textlink=new Array()
var texttarget=new Array()
<?php $recent = new WP_Query("showposts=1"); while($recent->have_posts()) : $recent->the_post();?>
text[0]="<?php the_title(); ?>."
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=1");while($recent->have_posts()) : $recent->the_post();?>
text[1]="<?php the_title(); ?>."
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=2");while($recent->have_posts()) : $recent->the_post();?>
text[2]="<?php the_title(); ?>."
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=3");while($recent->have_posts()) : $recent->the_post();?>
text[3]="<?php the_title(); ?>."
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=4");while($recent->have_posts()) : $recent->the_post();?>
text[4]="<?php the_title(); ?>."
<?php endwhile;wp_reset_query(); ?>
// Add a link for each message
// Enter "#" if you don't want to link a message (see sample below)
<?php $recent = new WP_Query("showposts=1");while($recent->have_posts()) : $recent->the_post();?>
textlink[0]="<?php the_permalink(); ?>"
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=1");while($recent->have_posts()) : $recent->the_post();?>
textlink[1]="<?php the_permalink(); ?>"
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=2");while($recent->have_posts()) : $recent->the_post();?>
textlink[2]="<?php the_permalink(); ?>"
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=3");while($recent->have_posts()) : $recent->the_post();?>
textlink[3]="<?php the_permalink(); ?>"
<?php endwhile;wp_reset_query(); ?>
<?php $recent = new WP_Query("showposts=1&offset=4");while($recent->have_posts()) : $recent->the_post();?>
textlink[4]="<?php the_permalink(); ?>"
<?php endwhile;wp_reset_query(); ?>
texttarget[0]="_self"
texttarget[1]="_self"
texttarget[2]="_self"
texttarget[3]="_self"
texttarget[4]="_self"
var textfont="Arial"
var textfontcolor="#333"
var textfontcolorrollover="#000"
var textfontsize=9
var textdecoration="none"
var textbgcolor="#eee"
var textweight="bold"
var textitalic="normal"
var textwidth=1000
var textheight=28
var textpause=3
var textborder=1
var textbordercolor="#aaaaaa"
var speed=70
document.write("<table border=0 cellpadding=0 cellspacing=0>")
document.write("<tr><td width="+textwidth+" height="+textheight+" valign=top dir=rtl>")
var textalign="right"
var textvalign="top"
var textitalicA=""
var textitalicB=""
var textweightA=""
var textweightB=""
var textfontsizeHTML=1
var i_mes=0
var i_substring=0
var i_presubstring=0
var i_text=0
var textcontent=""
var notag=true
var textpresubstring=""
var textaftersubstring=""
textpause*=1000
var browserinfos=navigator.userAgent
var ie4=!document.getElementById&&document.all&&!browserinfos.match(/Opera/)
var ie5=document.getElementById&&document.all&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all&&!browserinfos.match(/Opera/)
var opera=browserinfos.match(/Opera/)
function gettextcontent() {
tablewidth=textwidth-2*textborder
tableheight=textheight-2*textborder
textpresubstring=text[i_text].substring(0,i_presubstring)
var i_prepre=i_presubstring-1
if (i_prepre<0) {i_prepre=0}
if (text[i_text].substring(i_prepre,i_presubstring)=="<"){notag=false}
if (text[i_text].substring(i_prepre,i_presubstring)==">"){notag=true}
if (notag) {
textcontent="<table border=0 cellpadding=4 width="+tablewidth+" height="+tableheight+" class=\"mynews\" dir=rtl><tr valign="+textvalign+"><td align="+textalign+">"
textcontent+="<a href='"+textlink[i_text]+"' target='"+texttarget[i_text]+"' style='position:relative; font-family:"+textfont+";text-decoration:"+textdecoration+";font-family:"+textfont+";color:"+textfontcolor+";font-size:"+textfontsize+"pt;font-weight:"+textweight+";font-style:"+textitalic+"' onmouseover=\"this.style.color=\'"+textfontcolorrollover+"\'\" onmouseout=\"this.style.color=\'"+textfontcolor+"\'\">"
textcontent+=textpresubstring
textcontent+="</a>"
textcontent+="</td></tr></table>"
}
}
function showtickerNS6() {
textcontent="<table border=0 cellpadding=4 width="+textwidth+" height="+textheight+" class=\"mynews\"><tr valign="+textvalign+"><td align="+textalign+">"
textcontent+="<a href='"+textlink[i_text]+"' target='"+texttarget[i_text]+"' style='position:relative; font-family:"+textfont+";text-decoration:"+textdecoration+";font-family:"+textfont+";color:"+textfontcolor+";font-size:"+textfontsize+"pt;font-weight:"+textweight+";font-style:"+textitalic+"' onmouseover=\"this.style.color=\'"+textfontcolorrollover+"\'\" onmouseout=\"this.style.color=\'"+textfontcolor+"\'\">"
textcontent+=text[i_text]
textcontent+="</a>"
textcontent+="</td></tr></table>"
document.getElementById("ticker").innerHTML=textcontent
i_text++
if (i_text>=text.length-1) {i_text=0}
var timer=setTimeout("showtickerNS6()", 2*textpause)
}
function showticker() {
if (i_substring<=text[i_text].length) {
i_substring++
i_presubstring=i_substring-1
if (i_presubstring<0) {i_presubstring=0}
gettextcontent()
if (ie4) {
ticker.innerHTML=textcontent
var timer=setTimeout("showticker()", speed)
}
if (ie5 || opera || ns6) {
document.getElementById("ticker").innerHTML=textcontent
var timer=setTimeout("showticker()", speed)
}
}
else {
clearTimeout(timer)
var timer=setTimeout("changetext()", textpause)
}
}
function changetext() {
i_substring=0
i_presubstring=0
i_text++
if (i_text>text.length-1) {
i_text=0
}
showticker()
}
if (ie5 || ns6 || opera) {
if (ns6) {
textwidth-=2*textborder
textheight-=2*textborder
}
document.write('<div ID="roof" style="position:relative;width:'+textwidth+'px;height:'+textheight+'px;border-style:solid;border-width:'+textborder+'px;border-color:'+textbordercolor+';background-color:'+textbgcolor+'">')
document.write('<span ID="ticker" style="position:absolute;top:0px;left:0px;width:'+textwidth+'px;height:'+textheight+'px;"></span>')
document.write('</div>')
}
window.onload=showticker
document.write("</td></tr></table>")
</script>

و در محلی که قراره خبرها دیده بشند

<?php include (TEMPLATEPATH . 'news.php'); ?>

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...