vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Insert HTML or (pre-processed!) PHP file above specific forum (https://vborg.vbsupport.ru/showthread.php?t=67942)

Spinball 12-28-2004 08:12 AM

I have used my hack to display banners above and below threads.
Edit showthread.php and find
*********************************************
// ################################################## ###########################
// output page
eval('print_output("' . fetch_template('SHOWTHREAD') . '");');
*********************************************
and add this code before it:
*********************************************
$headerbanner = "<P ALIGN=\"CENTER\" CLASS=\"smallfont\">" . file_get_contents("http://www.url_of_your_script.php?forumid=$forumid&type=h eader") . "</P>";
$footerbanner = "<P ALIGN=\"CENTER\" CLASS=\"smallfont\">" . file_get_contents("http://www.url_of_your_script.php?forumid=$forumid&type=f ooter") . "</P>";
*********************************************
Then in the SHOWTHREAD template, find
*********************************************
$navbar
*********************************************
and after it, put
*********************************************
<if condition="$headerbanner">$headerbanner</if>
*********************************************
and find
*********************************************
<if condition="$bbuserinfo[field11] == 'Yes'">$quickreply</if>
*********************************************
and above it add
*********************************************
<if condition="$footerbanner">$footerbanner</if>
*********************************************

Then write your php script to output banners depending on what forumid is passed and whether it's the header or footer:

PHP Code:

$forumid $_REQUEST['forumid'];
$type $_REQUEST['type'];

switch (
$forumid) {
 case 
36:                                 // for your forum number 36 only...
   
if ($type == "header") {
      
$banners = array (
      
"banner_1.gif|banner_1.pl|The alt text|0|468|60",
      
"banner_2.gif|banner_2.pl|The alt text|0|468|60"
      
);
   } elseif (
$type == "footer") {
      
$banners = array (
      
"banner_3.gif|banner_3.pl|The alt text|0|468|60",
      
"banner_4.gif|banner_4.pl|The alt text|0|468|60"
      
);
   }
   break;
 case 
37:                                 // for your forum number 37 only...
   
if ($type == "header") {
      
$banners = array (
      
"banner_5.gif|banner_5.pl|The alt text|0|468|60",
      
"banner_6.gif|banner_6.pl|The alt text|0|468|60"
      
);
   } elseif (
$type == "footer") {
      
$banners = array (
      
"banner_7.gif|banner_7.pl|The alt text|0|468|60",
      
"banner_8.gif|banner_8.pl|The alt text|0|468|60"
      
);
   }
   break;
}
$banner $banners[mt_rand(0,sizeof($banners) - 1)];
list(
$imgsrc,$myurl,$alttext,$border,$width,$height) = explode ('|',$banner);
echo (
"<A HREF='http://www.your_domain.com/cgi-bin/$myurl' TARGET='_blank'><IMG src='http://www.your_domain/path_to_your/banners/$imgsrc?" mt_rand(1,9999) . "' border='$border' width='$width' height='$height' alt='$alttext'></A>"); 

I'm actually working on a complete vBulletin banner solution which enables you to display (rotating) banners above the forum list and also above and below every thread (and anywhere else you want). But it's work-in-progress.

Re your specific code request, I recommend you learn some PHP.
PHP Code:

if ($forumid==76 or $forumid==78 or $forumid==81

or if you have lots of forums, use the 'switch' command as per my example above.

Re displaying banners for whole categories, you might be able to do it, but I don't have time to look into it this year :)

keithsl 01-08-2005 04:17 PM

How would you do this if you want to include something on top of every page of the forum?

Spinball 01-08-2005 04:42 PM

You wouldn't need to use this hack - use the phpinclude_start template instead.

YLP1 01-08-2005 06:05 PM

Quote:

Originally Posted by Spinball
You wouldn't need to use this hack - use the phpinclude_start template instead.

Are there instructions for the php newbie to use this start tempate? Thanks in advance.

Spinball 01-08-2005 06:09 PM

Do a search on vbulletin.com for phpinclude

H@K@N 01-09-2005 12:10 PM

Hi,

i am going to try, to use the shoutcast status Box, which is availible for vba-portal, on my Forumhome.

When i try to include the shoutcast.php below the $navbar it says :

Code:

Fatal error: Call to undefined function: fetch_template() in /srv/www/htdocs/web1/html/shoutcast.php on line 68
On the Line 68 i have following :

Code:

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_shoutcast') . '";');
what should i change to have that script running ?

th@nks

sabret00the 01-09-2005 12:18 PM

try this, you're eval is a mess as is
PHP Code:

        eval("\$home['content'] .= \"" fetch_template("adv_portal_shoutcast") . "\";"); 


H@K@N 01-09-2005 03:12 PM

th@nks 4 reply, but i have still this error :

Code:

Fatal error: Call to undefined function: fetch_template() in /srv/www/htdocs/web1/html/shoutcast.php on line 68


here i paste the whole script :

PHP Code:

<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website

//Configuration
$scdef "TEst FM";   // Default station name
$scip "myipadress";       // ip or url of shoutcast server
$scport "8000";       // port of shoutcast server
$scpass "yourpass";  // password to shoutcast server
$maxusers "32"//max users for your server
//End configuration

$scfp = @fsockopen($scip$scport, &$errno, &$errstr3);

if(!
$scfp) {
eval(
"\$home['content'] .= \"" fetch_template("adv_portal_shoutcast_off") . "\";"); 
}else{
if(
$scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!
feof($scfp)) {
  
$page .= fgets($scfp1000);
}
}

//define  xml elements

$loop = array("STREAMSTATUS""BITRATE""SERVERTITLE""CURRENTLISTENERS");
$y=0;
while(
$loop[$y]!=''){
  
$pageed ereg_replace(".*<$loop[$y]>"""$page);
  
$scphp strtolower($loop[$y]);
  $
$scphp ereg_replace("</$loop[$y]>.*"""$pageed);
  if(
$loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
   $
$scphp urldecode($$scphp);

// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
  
$y++;
}
//end intro xml elements

//get song info and history
$pageed ereg_replace(".*<SONGHISTORY>"""$page);
$pageed ereg_replace("<SONGHISTORY>.*"""$pageed);
$songatime explode("<SONG>"$pageed);
$r=1;
while(
$songatime[$r]!=""){
  
$t=$r-1;
  
$playedat[$t] = ereg_replace(".*<PLAYEDAT>"""$songatime[$r]);
  
$playedat[$t] = ereg_replace("</PLAYEDAT>.*"""$playedat[$t]);
  
$song[$t] = ereg_replace(".*<TITLE>"""$songatime[$r]);
  
$song[$t] = ereg_replace("</TITLE>.*"""$song[$t]);
  
$song[$t] = urldecode($song[$t]);
  
$dj[$t] = ereg_replace(".*<SERVERTITLE>"""$page);
  
$dj[$t] = ereg_replace("</SERVERTITLE>.*"""$pageed);
$r++;
}
//end song info

fclose($scfp);
}

//display stats
if($scfp) {
if(
$streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
eval("\$home['content'] .= \"" fetch_template("adv_portal_shoutcast") . "\";"); 
} else {
eval(
"\$home['content'] .= \"" fetch_template("adv_portal_shoutcast_off") . "\";"); 
}
}
?>


i hade the eval twice, so i have tried also to change the eval below the server settings, but still not working.


gr33tz

sabret00the 01-09-2005 03:52 PM

you need to include the global.php :)

H@K@N 01-09-2005 05:21 PM

Quote:

Originally Posted by sabret00the
you need to include the global.php :)


Th@nks 4 help but i can't include that.

if i use :

require_once('./global.php');

into the Header of the php,Forumhome is going to open the shoutcast.php himself on the Index, and i cannot login anymore.

gr33tz


All times are GMT. The time now is 06:51 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.01298 seconds
  • Memory Usage 1,793KB
  • 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_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete