Problems, need help? Have a tip or advice? Post it here.
15 posts Page 1 of 2
I have a page that I need to list a bunch of videos, titles and descriptions. I set up the details page and the list page. When I try to embed the video list page for the else statement I get this error: Error embedding file.... using this tag just before the </cms:if>:

Code: Select all
<cms:else />
   <cms:embed 'video_list.php' />



I am using PHP for some nav includes on every page of the site and not sure if that is breaking it. When using the if k_is_page tag and else tag can you embed a php file to display the list of pages (videos)?

Here is some sample code from the page:
Code: Select all
<?php include_once ('header.php') ?>
<cms:pages masterpage='resources/videos.php' >
                        <article class="post post-medium">
                              <div class="row">
                                 <div class="col-md-5">
                                    <div class="post-image">
                                       <div class="portfolio-item">
                                          <div>
                                             <div class="img-thumbnail">
                                                <iframe width="445" height="315" src="<cms:show video />?rel=0&amp;autoplay=0&amp;wmode=opaque&amp;feature=player_embedded1&amp;controls=0&amp;showinfo=1" frameborder="0" allowfullscreen></iframe>
                                             </div>
                                          </div>
                                          
                                       </div>
                                    </div>
                                 </div>
                                 <div class="col-md-7">
                                    <div class="post-content">
                                       <h2><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h2>
                                       <p><cms:show video_desc /></p>
                                    </div>
                                 </div>
                              </div>
                           </article>
                            </cms:pages>
Hi Ton,
When using the if k_is_page tag and else tag can you embed a php file to display the list of pages (videos)?

The embedded file can contain only Couch tags.
We can use PHP in the snippet, though, via cms:php tag.
So, for example, changing the following statement from
Code: Select all
<?php include_once ('header.php') ?>

to
Code: Select all
<cms:php> include_once ('header.php') </cms:php>
should theoretically work but the preferred method would be to leave the PHP code to PHP runtime.

So, since the main template is always a PHP file, we should place all include in there.
I think you should modify the code to move the PHP include_once statement from the embedded snippet to the main template like this -
Code: Select all
<cms:if k_is_page >
   .. details ..
</cms:else />
   <?php include_once ('header.php') ?>
   <cms:embed 'video_list.php' />
</cms:if>

Hope this helps.
Thank you for the response KK. Unfortunately both of those methods did not fix it. Do I need to be including couch on the video-list page?
No, we don't need to include Couch in the embedded files (including Couch is required only on the main templates i.e. those that are shown in admin-panel's sidebar).

Can you please paste in the exact error you are receiving?
You might want to do a view-source of the page to clearly see the full error.
Here is the error:

Error embedding file: /home/content/85/7482585/html/DOMAIN/includes/video_list.php
OK, thanks.

The error can suggest that the embedded 'video_list.php' file is actually not found.

The cms:embed tag, by default, expects the embedded files to be present within 'couch/snippets' folder. This folder can be changed by specifying a different one in the config file.

So, please double check if a file with this name actually is present in the right location (the error message gives you the path of the folder being looked in and it seems you have set one in config file).
The file is definitely in the includes folder and I edited the config file to look inside /includes instead of /cms/snippets
Can you grant me FTP access to the site please?
Thanks for the creds.

I had a look and the file found in 'includes' folder is 'video-list.php' while the name you have specified is 'video_list.php'.
Notice the difference? (Hyphen v/s Underscore) :)
Facepalm.... Thanks for your help KK! Edit// now I am getting this error:

Parse error: syntax error, unexpected $end in /home/content/85/7482585/html/DOMAIN/cms/tags.php(2420) : eval()'d code on line 1
15 posts Page 1 of 2
cron