Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #46  
Old 14 Feb 2011, 10:37
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Where are you wanting the info to show up at? Every page?
Reply With Quote
  #47  
Old 14 Feb 2011, 15:24
Schoelle Schoelle is offline
 
Join Date: Feb 2011
Cool

Ok, i'll explain what i want to achieve, and hopefully you guys can help me.
I'm very new to vBulletin and my knowledge of php is also not 'the' best

I have a php script that is creating a linklist from files within a directory.
At the end of the script i have an echo statement to display the list.

What i want is to have this showing up inside a vbulletin page.
The only thing i have achieved so far is including this script in the new page i have created according to this: http://www.vbulletin.org/forum/showthread.php?t=228112

I have put

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

This end up in showing the created list above the forum header!


So what i want to achive is:
Including the output of several php scripts in several vbulletin pages.
www.mysite.com/script1.php > www.mysite.com/page1.php
www.mysite.com/script2.php > www.mysite.com/page2.php
and so forth.
Reply With Quote
  #48  
Old 14 Feb 2011, 17:34
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Of course you will see the created list if you use echo in the file. You need to use the function from the file to show the listing formatted to whatever template you set up for it.
Reply With Quote
  #49  
Old 15 Feb 2011, 16:43
Schoelle Schoelle is offline
 
Join Date: Feb 2011
Ok, lack of vbulletin knowledge + only very basic php knowledge = fail

I have now changed my script.php file so that the output is now a function.
When i include the script.php in a simple php script like this it works. So no problem in the script.

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

Now let's include this not in the simple script but in a vbulletin page!

I have a page.php file and a matching template.
These i have created after reading this tutorial:
http://www.vbulletin.org/forum/showthread.php?t=228112

In the page.php file i include script.php after global.php
require_once('./global.php');
require_once('./script.php');

What i still don't understand is where i now have to put "myfunction();" to show the output in a vbulletin page.
In the template? In a plugin?

Thanks for your help! Really appreciated!


Schoelle
Reply With Quote
  #50  
Old 01 Mar 2011, 17:59
cric2k cric2k is offline
 
Join Date: Jan 2010
I'm using this and it works, only I want to pass a variable (GLOBALS.foruminfo.title_clean) from my template to my PHP script.

I am attempting to pass the current Forum title and with my own PHP generate CSS to have a specific image for that forum in the background.

My Plugin code:

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

My problem is that $PageTitle = $GLOBALS.foruminfo.title_clean; doesn't populate in this place, I need to populate it in the template 'headinclude' any ideas?

--------------- Added 01 Mar 2011 at 22:23 ---------------

figured it out, didnt have to use the global variable - just used foruminfo[title_clean] which worked instead.

Last edited by cric2k; 01 Mar 2011 at 22:23. Reason: Auto-Merged DoublePost
Reply With Quote
  #51  
Old 05 Mar 2011, 20:43
drjamescook drjamescook is offline
 
Join Date: Jan 2011
I am using this hack to include a few php pages as it is intended. Everything works great, other than I cannot get form submits to work. I get a "Your submission could not be processed because a security token was missing."

I've looked around on the forum trying to find an answer, but I can't seem to find one. How can I correct this? Thanks.
Reply With Quote
  #52  
Old 12 Mar 2011, 11:28
Baylyns Baylyns is offline
 
Join Date: Mar 2005
Hello,

I'm on 4.1.2 and I used the code mentioned above to vb 4


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

in the navbar template I added:


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

By activating the module, I get a blank page.
Or is the problem?

Thank you
Reply With Quote
  #53  
Old 14 Mar 2011, 19:47
nick_h nick_h is offline
 
Join Date: Jun 2008
Can i put a VB variable in that php file such as {vb:raw totalthreads} ? I tried but not sucess
Reply With Quote
  #54  
Old 14 Mar 2011, 20:48
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Originally Posted by nick_h View Post
Can i put a VB variable in that php file such as {vb:raw totalthreads} ? I tried but not sucess
In a plugin or php file it would be $totalthreads. The {vb:raw ...} is only for use when displaying contents in a template.
__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
Reply With Quote
  #55  
Old 28 Mar 2011, 12:23
Muffin89 Muffin89 is offline
 
Join Date: Feb 2011
I could also use some help on including php file into a template.

I have a template with an header, a navbar, the forum/content, footer and a fixed right bar. I wan't to insert this php code(for now) into the right bar:

userbox.php

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

userbox plugin:

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

Inside the footer template I have made a div that is fixed and I call the plugin with this code:

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

But it doesn't output my desired string.

The HOOK is parse_templates.

When i in the plugin write echo $userboxinsert; the userbox get's inserted but at the top of the screen, so the link works.

Would be very happy if someone could help me with this problem!
Reply With Quote
  #56  
Old 07 Apr 2011, 08:20
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Real name: Karl
Total programming n00b here... asking for help


I just came here find out how to get a php-script to run, and was really glad to see you guys already had a page on the issue.

My idea is fairly simple:

I picked up a rotator script (php) and will upload to it's own directory (/rotator). I intend to have several copies (e.g. games.php, religion.php, cars.php, gadgets.php) and each script points to a different sub-directory, e.g. /games, /religion, /cars, /gadgets, etc.)

From there, in the last post of every thread I want to call it but will use an IF THEN to dictate which version it calls.

(e.g. IF forum=12 then call cars.php, else if forum=15 then call gadgets.php)
<vb:if condition="$GLOBALS['forumid'] == 63 OR $GLOBALS['forumid'] == 54 OR $GLOBALS['forumid'] == 56">
[not sure what to put here in order to call 'games.php']
<vb:if>
<vb:if condition="$GLOBALS['forumid'] == 3">
[not sure what to put here to call 'cars.php']
<vb:if>

This in turn should then reflect relevant files for specific forum content.

I suspect the IF THEN will be placed in the template 'ad_thread_last_post_content' (or via the Advertising/Manage Ads script within ACP).

I'm uncertain what hook I could use for this (these would only show on SHOWTHREAD templates - or is postbit_legacy as it's only in the last post?). I will later be adding a similar function to the bottom of specific forums to show different rotator scripts (different sized affiliates).


Any chance of a bit advice for getting this off the ground?
Reply With Quote
  #57  
Old 07 Apr 2011, 12:17
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
When you say "call" do you mean "display"? Is cars.php a page you can view with content if you browse to it?

If so I think what you are looking for is an IFRAME... the basic syntax would be:


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

That would embed the output from the php file into your existing page.

You can search google for more options on the IFRAME tag.
__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
Reply With Quote
  #58  
Old 07 Apr 2011, 13:20
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Real name: Karl
Although an iframe would suffice (thanks, I hadn't even given it a thought), I was under the impression I could an external php file from within a template..?

I'd prefer to do it as a display/call than within an iframe (which would not show to some browsers).

In worst case scenario though, i'll go with an iframe.
Reply With Quote
  #59  
Old 07 Apr 2011, 13:44
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
I just don't know what you mean by "call" a php file then... You can't do that from a template. You could do it from a plugin but again you're not "calling" a file. You can call a function in a file, but if you want to display output from the php file in a specific location you need to make a template for that file.
__________________
-Joe
Former vb.org Moderator. Retired.

@BirdOPrey5 | All Things BOP5 | Joe's Ultimate Off Topic
Note - I no longer making new VB mods, sorry.
Reply With Quote
  #60  
Old 07 Apr 2011, 22:10
karlm's Avatar
karlm karlm is offline
 
Join Date: Jul 2006
Real name: Karl
Originally Posted by BirdOPrey5 View Post
I just don't know what you mean by "call" a php file then... You can't do that from a template. You could do it from a plugin but again you're not "calling" a file. You can call a function in a file, but if you want to display output from the php file in a specific location you need to make a template for that file.
I may be using wrong terminology when i say "call"... I'm thinking old BASIC programming when you would call a subroutine.

Anyway, my idea is to:
1) breakdown forum into separate categories (e.g. religion, cars, games, etc.)

2) in the last post, 'refer to' a specific script.
2a) e.g. religion forum would refer to a script renamed as 'religion.php'
2b) cars forum would refer to a script renamed as 'cars.php'

3) the scripts within each above file would be the same, but refer to different text files.

4) the cars forum & script would then extract data from the text file for cars, which would ultimately show to the end-user as a affiliate image/link specific to cars.
4b) exactly the same as 4) but with religion context instead, so 'christian stuff' would show up in the religion forum (and other religions too).

so when a guest comes to my forum and visits the car section, they'll see links and/or images in the final post which will be pertinent to cars... if they swap over to the religion forum (or games or anything else) they will see the last post giving links/images relevant to those forums too.
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:46.

Layout Options | Width: Wide Color: