What I'm not understanding is why you would make several different php files when you could do the same with a single plugin or really even just template conditionals?
Can you give an example of the HTML code you want displayed from a php file? |
OK, I'm doing it this way because I'm not a PHP guru... I'm doing it in a way I can understand.
So what I've done now is in the 'manage ads' area of the ACP, i've enabled a 'last post only' ad-spot. While testing, it shows only to admins (once it goes live, i'll change this to show only to guests instead). The content of this ad-code is: Code:
<style type="text/css"> I'm sure I could somehow move the /rotate.php file into the parent directory and have it refer to different sub-directories according to what forumID is being viewed... I have no doubt that can be done. But - I don't know how to. So I'm trying to keep things simple for myself. |
Yeah I honestly can't see it getting any better than an IFRAME as you have it without making life A LOT for difficult.
In the unlikely event someone has a browser that doesn't allow IFRAMEs is there some static content you can put between the <IFRAME> and </IFRAME> tags besides "your browser does not support iframes" ? Maybe pick one of the codes you'll be randomizing so it's better than nothing? |
Just wanted to add, as I said previously, I'm not guru where coding is concerned... However, after a quick flick through the vbmanual, I've managed to condense my code using <vb:else if xyz /> statements and an additional <vb:else />. This means, now, it will check to see if viewer is in forum x,y,z and show appropriate php files - otherwise (if not in the above mentioned forums) it will show a google-adsense post instead.
WIN! |
I am planning on getting my entire site converted to take adbantage VB 4. I have more than 50,000 pages, so basically, I cannot use the global_start hook, since I would have hundreds of files / scripts loading on every page. This would not be good...
I thought about using global_start with one product (php master file), and then using conditionals within the script to decide which file to load. But decided to wait until I get some advice on this. One thing I did notice: If you have a php file loaded with global_start, every VB page may or may not use those variables. For example, I created a PHP script that looked for the last 5 forum posts, used a variable called $threadid. It happens to be that $threadid is also used within VB. So the last threadid that was called within my custom script forced VB to use that variable! All links on the forum loaded my own script's variable $threadid. Is this normal behavior? I did change my variable name to something unique, but I'm getting a little paranoid about this, because I may have more than this variable that is also used by VB. This is what I plan... Any feedback would be great. Product Example: ob_start(); include('Masterfile.php'); $masterfile = ob_get_contents(); ob_end_clean(); vB_Template::preRegister('customfiletemplate',arra y('loadexternalscripts' => $masterfile)); ---------------------------------- Masterfile.php Example: PHP Code:
Template: {vb: raw loadexternalscripts} The files would then be loaded like customfilepage.php?file=aboutus and Mod-rewrite would do the trick with bringing basic filenames to the request. |
I'm pretty sure I've heard the global_start hook isn't called on CMS pages anyway. They were going to remove that hook but kept it to keep compatibility with older mods, but didn't add it to the "new" parts of VB4.
I really can't image trying to work on 50,000 pages... good luck with that. But using the same variable names is a concern. Not only should you avoid the variable names used by vBulletin but also names other people have used in mods you have installed. When I make a mod I'll usually call my variables $bop_post or $bop_thread for example to know I'm not changing data used elsewhere. |
Thanks for the info Joe, do you think the method that I plan would work? This way, only one hook is created and loaded, waiting for $_GET instructions to fire off scripts.
|
Quote:
|
I am using VB to include 1 PHP file that is open to requests. These requests load the appropriate files if that's the page being requested. So, this allows a hook to be placed in global_start without actually loading a script and consuming enormous amounts of system resources. The 50,000+ pages are generated from about 10 scripts/programs.
In other words, I am using this script as a hook on global_start with a custom template that has the vb raw variable. This is my PHP code (Master.php). Seems to work very well so far. PHP Code:
PHP Code:
Code:
RewriteRule ^C/([^/]+).php$ /FN/M.php?csl=$1 [QSA,L] Mod-Rewrite generates About-Us.php and you're done. |
Thank you so freakin much!
The file get contents worked! |
All times are GMT. The time now is 11:30 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|