Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3562
| From | Goran <goran@nospam.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: execute php in template |
| Date | 2011-10-24 09:02 +0200 |
| Organization | T-Com |
| Message-ID | <j832id$ke4$2@ss408.t-com.hr> (permalink) |
| References | <a7a128ef-7730-4b2b-be6c-5fda82c287cf@31g2000prp.googlegroups.com> |
On 23.10.2011 21:47, cerr wrote:
> hi There,
>
> I have a page that i assemble with a graphics template and a content
> file in my index.php. Kinda like:
> <?
> $template = file_get_contents($tmpl_path);
> $content = file_get_contents($cont_path);
> and in template, there's a marker where to insert the content:
> $page = str_replace("[CONTENT]",$content,$template);
> echo $page.
>
> This works well so far, but if I wanna use php in my template, it
> doesn't get executed by file_get_contents(). How can I load this file
> and execute php within it? Also, I would like to reuse ($_GET)
> variables i have in index.php. Do I need to forward them to my
> template by a regular get url or will i just be able to reuse the
> variables straight?
> Thanks for help in this matter!
>
> Ron
Use output buffering functions to grab content before it is outputed.
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
execute php in template cerr <ron.eggler@gmail.com> - 2011-10-23 12:47 -0700
Re: execute php in template Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-23 16:29 -0400
Re: execute php in template The Natural Philosopher <tnp@invalid.invalid> - 2011-10-23 22:03 +0100
Re: execute php in template cerr <ron.eggler@gmail.com> - 2011-10-23 15:43 -0700
Re: execute php in template Gregor Kofler <usenet@gregorkofler.com> - 2011-10-24 01:20 +0200
Re: execute php in template Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-23 19:38 -0400
Re: execute php in template Hans Olo <doctor@vaderlishious.com> - 2011-10-23 20:37 -0500
Re: execute php in template Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-23 22:30 -0400
Re: execute php in template Hans Olo <doctor@vaderlishious.com> - 2011-10-24 07:39 -0500
Re: execute php in template Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-24 09:16 -0400
Re: execute php in template Goran <goran@nospam.com> - 2011-10-24 09:02 +0200
csiph-web