vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   need help with this custom script! (https://vborg.vbsupport.ru/showthread.php?t=67292)

msimonds 07-17-2004 09:09 PM

need help with this custom script!
 
I have a script here

PHP Code:

<?
include("include.inc.php");
include("config.inc.php");
//echo "<link href=$home/vbmynews/css.css rel=\"stylesheet\" type=\"text/css\">";
echo '<link href="css/sportsrant.css" rel="stylesheet" type="text/css">';
if(!$mynews && !$cat){
    if($n < 1){
        $news = headlines(1, $last, $news_forumid);
        foreach($news as $new){
            $post = smallnews($new['id'],$small);
            echo"<center><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr><td><table width=100% bgcolor=#EBCC6E style=\"border: 1px solid #000000;\"><tr height=25 ><td ><div align=\"right\"><a style=\"font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;    font-weight: bold;text-decoration: none; color: #000000;\" href=article".$new['id'].".html >".$new['title']."</a></div></td><td width=20 valign=top><img src=http://www.sportsrant.com/forums/images/statusicon/forum_new.gif></td></tr></table></td></tr><tr><td class=tdby><font size=2><span style=\"text-decoration: none\"><font size=\"1\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">".$new['dateline']."<br>by:</span> <a class=link href=".$home."/member.php?u=".$new['userid']." target=_".$new['userid'].">".$new['user']."</a></td></tr><tr><td align=left valign=top class=tdsmall><span style=\"text-decoration: none\"><font size=\"1\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">$post<script language=\"Javascript\" src=\"http://www.rantchaos.com/advertise/index.php?section=serve&action=1\"></script></span></td></tr></table><br><br></center>";
        }
    }else{
        $new = headline($n);
        $post = news($n);
        echo "<script>document.title=\"Rant Chaos :: ".$new['title']."\"</script>";
        echo "<center><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr><td><table width=100% bgcolor=#EBCC6E style=\"border: 1px solid #000000;\"><tr height=25 ><td ><div align=\"right\"><a style=\"font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;    font-weight: bold;text-decoration: none; color: #000000;\" href=article".$new['id'].".html >".$new['title']."</a></div></td><td width=20 valign=top><img src=http://www.sportsrant.com/forums/images/statusicon/forum_new.gif></td></tr></table></td></tr><tr><td><table width=100%><tr><td class=tdby width=50%><span style=\"text-decoration: none\"><font size=\"2\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">".$new['dateline']."<br>by:</span> <a class=linkhref=".$home."/member.php?u=".$new['userid']." target=_".$new['userid'].">".$new['user']."</a></td><td class=tdby width=80% align=\"right\"><a href=$npage class=link><img src=$home/vbmynews/images/back.gif alt=\"[back]\" border=0></a> <a href=$home/vbmynews/print.php?n=".$new['id']." class=link><img src=$home/vbmynews/images/print.gif alt=\"[print]\" border=0></a> <a href=\"#\" onClick=\"window.open('$home/vbmynews/friend.php?n=".$new['id']."','mywindow','width=400,height=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');\" class=link><img src=$home/vbmynews/images/mail.gif alt=\"[mail a friend]\" border=0></a> <a href=$home/showthread.php?t=".$new['id']." class=link><img src=$home/vbmynews/images/board.gif alt=\"[discuss on boards]\" border=0></a></td></tr></table></tr><tr><td align=left valign=top class=tdsmall><span style=\"text-decoration: none\"><font size=\"2\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">$post</span><br></td></tr></table></center>";
    }
}
if($cat){
    if($n < 1){
        $news = headlines(1, $last, $cat);
        foreach($news as $new){
            $post = smallnews($new['id'],$small);
            echo"<center><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr><td><table width=100% bgcolor=#EBCC6E style=\"border: 1px solid #000000;\"><tr height=25 ><td ><div align=\"right\"><a style=\"font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;    font-weight: bold;text-decoration: none; color: #000000;\" href=article".$new['id'].".html >".$new['title']."</a></div></td><td width=20 valign=top><img src=http://www.sportsrant.com/forums/images/statusicon/forum_new.gif></td></tr></table></td></tr><tr><td class=tdby><font size=2><span style=\"text-decoration: none\"><font size=\"1\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">by</span> <a class=link href=".$home."/member.php?u=".$new['userid']." target=_".$new['userid'].">".$new['user']."</a>  </td></tr><tr><td align=left valign=top class=tdsmall><span style=\"text-decoration: none\"><font size=\"1\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">$post</span></td></tr></table><br><br></center>";
        }
    }else{
        $new = headline($n);
        $post = news($n);
        echo "<script>document.title=\"Rant Chaos :: ".$new['title']."\"</script>";
        echo "<center><table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr><td><table width=100% bgcolor=#EBCC6E style=\"border: 1px solid #000000;\"><tr height=25 ><td ><div align=\"right\"><a style=\"font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;    font-weight: bold;text-decoration: none; color: #000000;\" href=article".$new['id'].".html >".$new['title']."</a></div></td><td width=20 valign=top><img src=http://www.sportsrant.com/forums/images/statusicon/forum_new.gif></td></tr></table></td></tr><tr><td><table width=100%><tr><td class=tdby width=50%><span style=\"text-decoration: none\"><font size=\"2\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">by:</span> <a class=linkhref=".$home."/member.php?u=".$new['userid']." target=_".$new['userid'].">".$new['user']."</a></td><td class=tdby width=80% align=\"right\"><a href=$npage class=link><img src=$home/vbmynews/images/back.gif alt=\"[back]\" border=0></a> <a href=$home/vbmynews/print.php?n=".$new['id']." class=link><img src=$home/vbmynews/images/print.gif alt=\"[print]\" border=0></a> <a href=\"#\" onClick=\"window.open('$home/vbmynews/friend.php?n=".$new['id']."','mywindow','width=400,height=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');\" class=link><img src=$home/vbmynews/images/mail.gif alt=\"[mail a friend]\" border=0></a> <a href=$home/showthread.php?t=".$new['id']." class=link><img src=$home/vbmynews/images/board.gif alt=\"[discuss on boards]\" border=0></a></td></tr></table></tr><tr><td align=left valign=top class=tdsmall><span style=\"text-decoration: none\"><font size=\"2\" color=\"#555555\" face=\"Verdana, Arial, Helvetica, sans-serif\">$post</span><br></td></tr></table></center>";
    }
}
if($mynews == "post"){
//    if($bbuserinfo['forumpermissions'][$news_forumid] < 66000){
//        echo "sorry, you have no access to post news";
//        print_r($bbuserinfo);
//    }else{
        echo '<form enctype="multipart/form-data" method="POST" class="tdby" action="'.$fileroot.'/post.php">
<p>title:<br>
<input name="title" type="text" size="30">
</p>
<p>image: (jpg/jpeg only)<br>
<input name="foto" type="file" size="30">
</p>
<p>news:<br>
<textarea cols="20" rows="5" name="post" style="width:90%; height:250px"></textarea>
</p>
<center>
<input type=submit name=send class=tdby value=send>
</center>
</form>';
//    }
}
?>

I have an advertising javascript that I want to place in the first story only! I have added it to the echo and it is showing up in all the stories on the home page. can someone help me with this!

The javascript call is:

Quote:

<script language="Javascript"
src="http://www.rantchaos.com/advertise/index.php?section=serve&action=1">
</script>
and you can find it in the first echo command!!


you can see what I mean by going to htp://www.rantchaos.com

Thanks
Mike

Loon 07-18-2004 03:46 PM

not sure if you fixed it, but i can't see a problem on that page or quite see in your code which part is the ad you want to insert, but basically, as you're using foreach() then do something like this:

PHP Code:

$x 1;
foreach(
$var1 as $var2)
{
if(
$x == 1) {
      print 
'your ad code here';
      print 
'your news code here';
}
else {
      print 
'your news code here';
    }
$x++;



$x is then increased by 1 for each item, and your ad will only print on the first, other than that just put your ad outside the loop.

PHP Code:

print 'your ad code';
foreach(
$var1 as $var2)
{
     print 
'your news code';



msimonds 07-18-2004 07:18 PM

thanks man, that is great and I really appreciate it


All times are GMT. The time now is 10:32 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01267 seconds
  • Memory Usage 1,749KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete