vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP Include in Header (https://vborg.vbsupport.ru/showthread.php?t=160439)

Marc.F 10-17-2007 10:27 AM

PHP Include in Header
 
Hi Guys..

I am in the process of creating a skin for my forum but i have ran into a problem.

My problem is:

Can i use a PHP include such as:

PHP Code:

<?php
  
include('../../core.php');
  
top('Forum');
?>

in my header template (not headerinclude).

Cheers,
Marc

Marco van Herwaarden 10-17-2007 10:40 AM

No, you can not use PHP in templates, they are only HTML.

You can however create a plugin with your PHP-code, assign the output to a variable and use that variable in your template.

Marc.F 10-17-2007 11:07 AM

Ill give that a try and post back! Thanks!

By the way, what would my Hook Location be? The header?

--------------- Added [DATE]1192626390[/DATE] at [TIME]1192626390[/TIME] ---------------

Anyone?! Please!!

Analogpoint 10-17-2007 02:20 PM

Use global_start if you want it to be available on all pages.

Marc.F 10-17-2007 02:26 PM

Ok, thanks but how do i put this in my template?

As you can probubly guess, im a beginner with vBulletin code!

Analogpoint 10-17-2007 02:30 PM

Plugin on the global_start hook:
PHP Code:

$myheader '<h1>My Header Here</h1>'

Then near the top of your header template:
Code:

<!-- logo -->
<a name="top"></a>

$myheader


Marc.F 10-17-2007 02:46 PM

Thanks,

I have created a new product (called 'nav') and added a plugin within (called 'navshow') it's hook location is global_start... In plugin 'navshow i have:

Code:

$navig ='<?php
  include('../../../core.php');
  top('Forum');
?>';

Also, in my header template i have $navig.

It still isnt working, what am i doing wrong :(

Thanks in advance!

Analogpoint 10-17-2007 02:52 PM

Change your plugin code to:
PHP Code:

ob_start();
include(
'../../../core.php');
top('Forum');
$navig ob_get_clean(); 


Dismounted 10-18-2007 06:01 AM

<a href="http://www.vbulletin.com/docs/html/templates_externalfiles" target="_blank">http://www.vbulletin.com/docs/html/t..._externalfiles</a>

Marc.F 10-18-2007 08:09 AM

Quote:

Originally Posted by Dismounted (Post 1362884)

Thanks! Just what i was looking for!


All times are GMT. The time now is 02:17 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.01052 seconds
  • Memory Usage 1,737KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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