Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 09-05-2004, 10:55 AM
Liquid1ce's Avatar
Liquid1ce Liquid1ce is offline
 
Join Date: Feb 2004
Location: /root
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBAdvanced - <?php include("file.php"); ?>

Im using vBAdvanced & i have a php script that fetches data from a site a spits it out onto mine, but if i create a template on vbadvanced and put <?php include("file.php"); ?> nothing shows up.

& i need to do this with around 8 pages - Any one tell me how to do this

Regards
Reply With Quote
  #2  
Old 09-05-2004, 01:01 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you can't use php code in templates, besides what you use in template conditionals.
Reply With Quote
  #3  
Old 09-05-2004, 10:24 PM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's a link to a thread on vbadvanced.com on how to do just that: http://www.vbadvanced.com/forum/showthread.php?t=1082

Now, I've got a question that I've searched through this site and vbadvanced for the answer with no luck. How many variables can be passed to a template from php? I got 1 to work fine, but more than one is causing problems. I've actually posted to the same thread I gave you the link to. I'm racking my brain pretty good. This hurts!
Reply With Quote
  #4  
Old 09-06-2004, 12:10 AM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what do you mean by passing variables to a template? You can use any number of variables within a template, assuming the variables exist in the php script from which the template is called
Reply With Quote
  #5  
Old 09-06-2004, 12:19 AM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rake
what do you mean by passing variables to a template? You can use any number of variables within a template, assuming the variables exist in the php script from which the template is called
Thank you for the quick response. That's what I was thinking, but for some reason, when I'm passing more than one, I get an IE "Unspecified error" message.

Here's a copy of the php script:

PHP Code:
<?php
// Get a file into an array.  In this example we'll go through HTTP to get 
// the HTML source of a URL.

// This file is a listing of all thumbnail gifs with full path
// X:\FTP\MYPICS\YYMMDDXX.B\THUMBS\FILENAME.GIF
$fileArray file('http://pics.huntsvillecarscene.com/events/testfile');

// Counts total number of lines in file to determine how many total pictures
$totalPics count($fileArray);
//print "$totalPics\n";

// Line number of random line from file
$randomArray array_rand($fileArray);
//print "$randomArray\n";
//print "$fileArray[$randomArray]\n";

// Truncates the first 14 and last 21 characters to eliminate the path
$picDirectory substr($fileArray[$randomArray], 14, -22);
//print "$picDirectory\n";

// Get the root of the pic filename
$picFilename substr(strchr($fileArray[$randomArray], "\\"),strrpos($fileArray[$randomArray], "\\")-1,-6);
//print $picFilename;

eval('$home[$mods[\'modid\']][\'content\'] .= "' fetch_template('adv_portal_randomevent') . '";');
?>
And then this is the html in the template:
PHP Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]class="tborder" width="100%">
<
tr>
<
td class="tcat"><span class="smallfont"><b>$vba_options[portal_blockbulletRandom Event Pic</b></span></td>
</
tr>
<
tr>
<
td class="$getbgrowwidth="100%">

<!-- 
Begin custom code -->
<
center>
<!--
<
img src="http://pics.huntsvillecarscene.com/events/$picDirectory/thumbs/$picFilename.gif">
-->
Pic $randomArray of $totalPics total pics on the server.
</
center>
<!-- 
End custom code -->

</
td>
</
tr>
</
table>
<
br /> 
The whole thing is designed to pull random images off my picture server, which is only a win95 system running a very tiny and basic web server that does the job. There's over 5gb of pictures which I don't want to move into vb, but that I still can link to. I'm using this in conjunction with vbadvanced cmps for a module. Any help will be appreciated. I really wanted to finish this by today.
Reply With Quote
  #6  
Old 09-06-2004, 01:22 AM
Liquid1ce's Avatar
Liquid1ce Liquid1ce is offline
 
Join Date: Feb 2004
Location: /root
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thnx v/much for your help guys it works sweet
Reply With Quote
  #7  
Old 09-06-2004, 01:47 AM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey, I got it working! Apparently there was some extra junk below the ending php tag that was causing some problems. Everything works great now. Too bad it's on my local test server, or I'd put up a link.
Reply With Quote
Reply

Thread Tools
Display Modes

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 09:54 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.03725 seconds
  • Memory Usage 2,225KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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