Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
I currently use PHP includes throughout my site i.e. Header, Navigation, Footer etc. and I have a file called news_list.php in the snippets folder - but obviously the standard PHP include code does not work on this file as I believe only Couch Tags can be used on the files in the Snippets folder.

So I tried using this tag: <cms:php> include('inc/header.php'); </cms:php>

And it does bring the include in - but it doesn't display all the information from the header.php file as some it is brought in via Couch Tags and this is the information that isn't displaying.

Can anyone help me figure this out??

Thanks in advance :)
Hi,

Only the PHP code that resides in embedded snippets (i.e. files included using cms:embed tag) needs to be ported to cms:php tags.

If the PHP code exists on your main template (i.e. is not embedded), it can be left as is and it should work just as before.

Suppose your original code in the main template was
Code: Select all
<?php
include('inc/header.php');
?>

You can try leaving the existing arrangement unchanged.

Alternatively, if you wish to place the 'header.php' in Couch's snippets folder, then you'll have to use
Code: Select all
<cms:embed 'header.php' />
and now any native PHP code within header.php will have to be ported to cms:php.

For example, if within header.php there was a statement
Code: Select all
<?php echo 'hello world'; ?>

it'll need to be changed into
Code: Select all
<cms:php>echo 'hello world';</cms:php>

Does this help?
2 posts Page 1 of 1