Jump to content

[IPS4] parse include?


LaCollision

Recommended Posts

Posted

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,

Posted


{{ 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,

Posted

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

​Thanks 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,

Posted

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?

>_<

Posted

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.

Posted

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 :) 

  • 10 months later...
Posted

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 :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...