Page 1 of 1

how to make php template

Posted: Wed Jan 05, 2011 6:09 am
by vindesign
:( hai iam newbie in php. so i want to make a template for side menu

include("sidemenu.php"); just like this when i use this in subfolders getting 404 error how can i get rid of this.
please help me and i'm also want to span the same page how can i use sidemenu.php template in all pages.

Re: how to make php template

Posted: Wed Jan 05, 2011 6:34 am
by josh
A 404 error means you mis-typed the URL, there is no PHP issue.

Re: how to make php template

Posted: Wed Jan 05, 2011 7:00 am
by vindesign
hey bro i just want to know
in this page folder1/page1.php
index.php linked as ../index.php
if using php template for side menu
the link is ../index.php
if
using folder1/another_folder/apage.php
here the link of index.php would be ../../index.php
so
the template link not work

how can i fix this using one template for all pages.........
and
also
in folder1/another_folder/apage.php the same page link not work in that page, i also want to config in the same page..... how can i code yaar please help me

Re: how to make php template

Posted: Thu Jan 13, 2011 12:12 am
by kalpesh.mahida
It would be better if you define some named constant using define() and use them out in loading file resources of your application.

like below you can have few named constant, that can help you out to load resources.

[syntax=php]<?php

define('APP_ROOT', 'Put value as per your need'); // path to your root directory
define('PATH_LIB', 'Put value as per your need'); // path to your library directory
define('PATH_MODULE', 'Put value as per your need'); // path to your module directory

......
?>[/syntax]

Re: how to make php template

Posted: Thu Jan 13, 2011 5:37 am
by vindesign
thanks

Re: how to make php template

Posted: Mon Feb 21, 2011 1:45 pm
by s.dot
How about just:

Code: Select all

include $_SERVER['DOCUMENT_ROOT'] . '/sidemenu.php';