Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #61  
Old 08 Apr 2011, 01:26
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
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?
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #62  
Old 08 Apr 2011, 12:46
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Real name: Karl
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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

In each directory is a series of text files with affiliate codes and the rotator picks a random file each time a viewer reads a thread.

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.
Reply With Quote
  #63  
Old 09 Apr 2011, 02:32
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
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?
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #64  
Old 10 Apr 2011, 15:07
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Real name: Karl
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!
Reply With Quote
  #65  
Old 17 Apr 2011, 07:02
iwpg iwpg is offline
 
Join Date: May 2008
Dozens of files, best hooks...

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:reRegister('customfiletemplate',array('loadexternalscripts' => $masterfile));

----------------------------------

Masterfile.php Example:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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.
Reply With Quote
  #66  
Old 17 Apr 2011, 17:42
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
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.
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #67  
Old 18 Apr 2011, 04:56
iwpg iwpg is offline
 
Join Date: May 2008
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.
Reply With Quote
  #68  
Old 18 Apr 2011, 05:25
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Originally Posted by iwpg View Post
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.
I'm really not understanding what you are really doing... surely you don't plan to write a php elseif statement with 50,000 options...
__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #69  
Old 19 Apr 2011, 05:55
iwpg iwpg is offline
 
Join Date: May 2008
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.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Included script on the hook (M.php):

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Mod-Rewrite Code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then call it like M.php?csl=About-Us
Mod-Rewrite generates About-Us.php and you're done.
Reply With Quote
  #70  
Old 06 Aug 2011, 22:55
angelcosta angelcosta is offline
 
Join Date: Nov 2010
Thank you so freakin much!

The file get contents worked!
Reply With Quote
  #71  
Old 23 Dec 2011, 10:09
absofts's Avatar
absofts absofts is offline
 
Join Date: Oct 2011
Real name: Muhammad Bilal
I include a file but its showing me this error

Fatal error: Call to a member function query_read_slave() on a non-object in /home/content/i/c/o/icompany/html/forum/verified.php on line 4
--------------- Added 23 Dec 2011 at 10:10 ---------------

My file code is


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Muhammad Bilal
Programer
Reply With Quote
  #72  
Old 23 Dec 2011, 19:13
iwpg iwpg is offline
 
Join Date: May 2008
I''m not sure where query_read_slave is loaded. Did you try loading the hook in global_start?
Reply With Quote
  #73  
Old 23 Dec 2011, 19:17
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
You should be using $vbulletin->db... to access queries, data, and the like... try this code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
-Joe
Former vBulletin.org Staff Member

(@BirdOPrey5) Former vb.org Moderator. Fighting for a free & independent vb.org.
BirdOPrey5.com - Exclusive VB Mods! (Formerly Qapla.com) | Joe's Ultimate Off Topic
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #74  
Old 18 Mar 2012, 22:30
iiFragyyHD iiFragyyHD is offline
 
Join Date: Oct 2011
Can I add 2 plugins like this?

--------------- Added 18 Mar 2012 at 22:31 ---------------

Nevermind, got it. All you have to do is change bot $php_include variables and the array name to the same thing.
Reply With Quote
  #75  
Old 21 Mar 2012, 03:05
zero477 zero477 is offline
 
Join Date: Jan 2012
Thanks it works perfectly, they should update or make more clear the vBulletin manual...

--------------- Added 21 Mar 2012 at 03:37 ---------------

Hello Crimm,

Thanks very much for your post about including PHP files ... It was much more clear than in the manual.

I followed your instructions and everything works fine for the forum, but in the CMS the PHP file is not included.

I tried to fix it by adding:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

To global_start of the CMS. But it still does not work... Can you help me?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 20:56.

Layout Options | Width: Wide Color: