Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 06:17:55 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155547 Posts in 21714 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: <?php require(WB_PATH correct?  (Read 468 times)
pivey

Offline Offline

Posts: 33


« on: June 09, 2011, 12:52:55 PM »

Hi,
before i mess better to confirm:

i have several templates in a multilang site and prefer to call my header menu from a single file headerTop.php

is it correct to call it with php require?
<?php require(WB_PATH.'/templates/headerTop.php'); ?>

need to confirm, thank you!
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2297



WWW
« Reply #1 on: June 09, 2011, 01:07:30 PM »

It is no problem to do it that way.

Using require, require_once, include or include_once does not make much difference here.
Require will stop execution at that point if the file is not found, Include will continue after writing an error.
Since that file will always be present, you could use any of those.
Logged

Professional WebsiteBaker Solutions
pivey

Offline Offline

Posts: 33


« Reply #2 on: June 09, 2011, 07:55:33 PM »

Hi Ruud, vielen Dank.

Thank you for the confirmation.
Nice to hear
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #3 on: June 09, 2011, 09:21:35 PM »

One warning, make sure your included/required file starts with a check to see if it was called the right way, from within wb to prevent direct access.

Code:
// Stop this file being access directly
if(!defined('WB_URL')) {
header('Location: ../index.php');
exit(0);
}


have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
pivey

Offline Offline

Posts: 33


« Reply #4 on: June 09, 2011, 11:47:07 PM »

oh.. that one was important, was wondering how direct access restriction was handled anyway.
Thx a lot for this hint  wink
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!