LaCollision Posted February 5, 2015 Posted February 5, 2015 Hi there,With IPS 3.x, I was used to parse PHP files in templates, like that:{parse include="../path/to/my/file.php"}Is there a way to achieve the same with IPS4?Thanks a lot,
LaCollision Posted February 5, 2015 Author Posted February 5, 2015 {{ include('...'); }}Hi,Thanks, that's what I did, but as it is part of an IPS template, I get the famous error "Cannot modify header information - headers already sent by…"Any idea?Thanks again,
Andy Millne Posted February 5, 2015 Posted February 5, 2015 Perhaps if you explain what the end goal is it might be easier to advise. It's possible what you are trying to do is better suited to a theme hook
LaCollision Posted February 5, 2015 Author Posted February 5, 2015 Perhaps if you explain what the end goal is it might be easier to advise. It's possible what you are trying to do is better suited to a theme hookThanks a lot Andy for your help.My needs are very basic: my Invision installation is part of a "regular" website. I just want to include in the globalTemplate some PHP files, that display parts of my website (for instance a "latest news" block somewhere in the template).With the IPB 3.x {parse include="…"} instruction, I was able to do it very simply, without going too deep in the IP.Board configuration (creating a hook…).Do you think it is possible with IPS 4 ?Thanks again,
LaCollision Posted February 5, 2015 Author Posted February 5, 2015 Perhaps if you explain what the end goal is it might be easier to advise. It's possible what you are trying to do is better suited to a theme hook I did something like that: {{include('../path/file.php');}} {$renderedPHP|raw} With the file.php using a buffer system: $renderedPHP = ""; ob_start(); include('the-file-i-want-to-include.php'); $renderedPHP = ob_get_contents(); ob_end_clean(); … but it's not very clean, is it?
Andy Millne Posted February 5, 2015 Posted February 5, 2015 I guess we could add a similar template plugin to do this in 4.x. I'll raise it for discussion as there may be a good reason it was not included.
LaCollision Posted February 5, 2015 Author Posted February 5, 2015 I guess we could add a similar template plugin to do this in 4.x. I'll raise it for discussion as there may be a good reason it was not included.Thanks a lot, that would be amazing.
Andy Millne Posted February 5, 2015 Posted February 5, 2015 The syntax for this in the next release will be{insert="yourfile"}include caused a naming conflict
LaCollision Posted February 5, 2015 Author Posted February 5, 2015 The syntax for this in the next release will be {insert="yourfile"} include caused a naming conflict I love you
TSP Posted February 5, 2015 Posted February 5, 2015 Thanks Andy, we've also been using the same to include some simple html files that are generated to the shared file system from another system to incorporate some articles. It's good it's a quick and easy thing to do
LaCollision Posted February 5, 2015 Author Posted February 5, 2015 The syntax for this in the next release will be {insert="yourfile"} include caused a naming conflict Is it included in Beta 7?
ipbfuck Posted December 15, 2015 Posted December 15, 2015 Hi, i've try this directly in template, but not work for me... someone can try to best explain, please? :/ - edit: Ok, sorry, in first moment i've try with full server path and this not work. After of this i've try with path from ipb root, and work fine
Recommended Posts
Archived
This topic is now archived and is closed to further replies.