[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 08-21-2006, 02:05 AM   #1 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Location: United Kingdom
Posts: 344
482.75 NP$ (Donate)

lee101 is a jewel in the roughlee101 is a jewel in the roughlee101 is a jewel in the rough


Parsing file opened using fread

Hi,
I have created a script that opens a template in order to show thepage, and used str_replace to "dynamically" update the elements, similar to this:
http://www.namepros.com/code/189417-...-php4-5-a.html
Although one of the things I want to do is:
replace whever it says {CONTENT} with
PHP Code:
<?php include($page); ?>
Which i can do, although then the PHP code just shows up on the page, so it seems like it needs to be parsed (right word?) again, and I can't fund any functions to do that, is there any way for thisto be done?
Here is the PHP code:
PHP Code:
<?php
//open the configuration file
include('config.php');
//open the functions file
include('functions/functions.php');
//page variables
$page="index.php";
?>
<?php
//open the page template
$template=getconf('template');
$template='template/'.$template.'/index.htm';
$handle=fopen($template,'r');
$display_template=fread($handle,filesize($template));
fclose($handle);
//prepare image and css links for viewing
$display_template=str_replace('elements/','template/'.getconf('template').'/elements/',$display_template);
//prepare all other template features
$display_template=str_replace('{PAGE_TITLE}',getconf('page_title'),$display_template);
$display_template=str_replace('{FOOTER}',getconf('footer'),$display_template);
$display_template=str_replace('{HEADER}',getconf('header'),$display_template);
$display_template=str_replace('{CONTENT}',$page,$display_template);
echo
$display_template;
?>
Thanks, Lee
__________________
http://bypasstopsite.com - Submit your proxy!
http://biggertwitter.com - Make twitter a bit bigger!
Currently Developing - Linux Screenshots
lee101 is offline  
Old 08-21-2006, 06:28 AM   #2 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Location: United Kingdom
Posts: 344
482.75 NP$ (Donate)

lee101 is a jewel in the roughlee101 is a jewel in the roughlee101 is a jewel in the rough


ok, it doesn't matter now, i fixed it, used
PHP Code:
ob_start();
$template=getconf('template');
include(
'template/'.$template.'/index.htm');
$display_template = ob_get_contents();
ob_end_clean();
Instead
__________________
http://bypasstopsite.com - Submit your proxy!
http://biggertwitter.com - Make twitter a bit bigger!
Currently Developing - Linux Screenshots
lee101 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 03:04 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85