Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2004, 09:09 PM
msimonds msimonds is offline
 
Join Date: Aug 2003
Location: Dallas, Texas
Posts: 157
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 07-18-2004, 03:46 PM
Loon Loon is offline
 
Join Date: Nov 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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';

Reply With Quote
  #3  
Old 07-18-2004, 07:18 PM
msimonds msimonds is offline
 
Join Date: Aug 2003
Location: Dallas, Texas
Posts: 157
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks man, that is great and I really appreciate it
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:38 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.09167 seconds
  • Memory Usage 2,201KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete