php templates

unable to load template file from php - Urgent

Page 1 of 1

3 Replies - 2226 Views - Last Post: 31 August 2008 - 01:14 AM Rate Topic: -----

#1 baachitech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-August 08

php templates

Posted 26 August 2008 - 11:04 AM

Hi Friends, I am new to PHP. I want use php templates in my site.
my directory structure as follows:
note: all script files stored in sources folder.
all template files stored in templates folder.

/index.php
/sources/details.php
/templates/details.tpl

Now, I am sending parameters to index.php like.. http://localhost/ind...details.view.10

the code for index.php as follows:
<?php
$src_path = "sources/";
$tpl_path = "templates/";

$ls = $_GET['page'];

// first parameter is the page name
// second param is action type
// third param is product id/navigation page #

list($p1, $p2, $p3) = split('[.]', $ls);

if ($p1=="details")
  { include("sources/details.php?id=".$p3);}
else
  { // display some other file;}
?>



code for details.php file:
<?php
//   get some data from database
//   included template.php file

$template = new Template;
$template->set_file('main', 'templates/details.tpl');
$template->set_var("PAGETITLE", "Description for Page Title");

$details= GetDetails($propid);

$template->set_var("ADDRESS",$details['address']);
$template->set_var("CITY",$details['cityname']);

$template->pparse('out', 'main');
?>




the details.tpl file:
<html>
<head><title>{PAGETITLE}</title></head>
<body>
   Customer Address: {ADDRESS} <BR>
   Customer City: {CITY}
</body>
</html>



Now, when use http://localhost/ind...details.view.10

It'll excute details.php file but it won't display the details.tpl file in browser.

and also i need to know how to set source and templates path to them.

Please help. ThanQ for you help

Take kare
Sudha

Is This A Good Question/Topic? 0
  • +

Replies To: php templates

#2 jonesa01  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 125
  • Joined: 18-February 07

Re: php templates

Posted 28 August 2008 - 09:31 AM

Hi,

Can you post the code for template.php, so I can piece together the code, so it will be easier to see what is wrong.

Adam
Was This Post Helpful? 0
  • +
  • -

#3 baachitech  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-August 08

Re: php templates

Posted 29 August 2008 - 11:14 AM

View Postjonesa01, on 28 Aug, 2008 - 09:31 AM, said:

Hi,

Can you post the code for template.php, so I can piece together the code, so it will be easier to see what is wrong.

Adam


Hi Adam, Thanq for spending time. Actually the entire site buit by some one and they encripted the source with ioncube. we bought it from that company. they given all the source code except the main index.php. they said, they don't have source for index.php.

one month back i started to learn PHP, and now i able to create the main index.php file to use the templates.

I findout that, I forgot to include one of the include file. that is why the template display nothing. now it is ok.

ThanQ verymuch for spending your valuable time.

Take Kare
Sudha
Was This Post Helpful? 0
  • +
  • -

#4 jonesa01  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 125
  • Joined: 18-February 07

Re: php templates

Posted 31 August 2008 - 01:14 AM

View Postbaachitech, on 29 Aug, 2008 - 11:14 AM, said:

View Postjonesa01, on 28 Aug, 2008 - 09:31 AM, said:

Hi,

Can you post the code for template.php, so I can piece together the code, so it will be easier to see what is wrong.

Adam


Hi Adam, Thanq for spending time. Actually the entire site buit by some one and they encripted the source with ioncube. we bought it from that company. they given all the source code except the main index.php. they said, they don't have source for index.php.

one month back i started to learn PHP, and now i able to create the main index.php file to use the templates.

I findout that, I forgot to include one of the include file. that is why the template display nothing. now it is ok.

ThanQ verymuch for spending your valuable time.

Take Kare
Sudha


No problem, in future I would suggest that you spend a bit more, and get them not to encrypt it. Its just a way to get more money from you :(.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1