Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi,

I have a site online that was working well with couchcms used for managing certain sections of my pages. I recently modified the title tag for SEO and uploaded the files again. I can view all my pages by typing the url directly except for the index page that throws up an error

ERROR: Tag "pages": masterpage 'news_sidebar.html' not found

Based on previous experience and answers i got here, i visited the pages manually again and still not able to view the index page and this is the code from the index.php page

Code: Select all
<?php require_once('admin/cms.php'); ?>
<cms:template title='Home Page' />
<cms:pages masterpage='news_sidebar.html' />

<!DOCTYPE html>
<html lang="">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Covenant Kings & Queens Academy | Home</title>
   </head>
   
   <body>
      <div class="container">

           <section>
              <!-- News area -->
              <div class="col-md-4">
                 <cms:embed 'news_sidebar.html' />
              </div>
           </section>
          
      </div>
   </body>
</html>
<?php COUCH::invoke(); ?>


news_sidebar.html code is

Code: Select all
<h1>Latest News</h1>
<cms:pages masterpage='news.php' limit='2'>
<h3><cms:show k_page_title /></h3>
<cms:excerptHTML count='30' ignore='img'><cms:show news_content /></cms:excerptHTML>
<p class="clearfix"><a href="<cms:show k_page_link />" class="btn btn-success pull-right"> Read More...</a></p>
</cms:pages>


What could be responsible for this error? Your contributions are appreciated.
news_sibebar.html is not a masterpage. It's a snippet. Masterpages will always have the php extension and be Couch templates. Simply removing
Code: Select all
<cms:pages masterpage='news_sidebar.html' />
from the code should fix the problem. The snippet already includes the pages tag.
tim wrote: news_sibebar.html is not a masterpage. It's a snippet. Masterpages will always have the php extension and be Couch templates. Simply removing
Code: Select all
<cms:pages masterpage='news_sidebar.html' />
from the code should fix the problem. The snippet already includes the pages tag.


Thanks tim, i fixed it by changing news_sidebar.html to news.php

I wonder how that line changed in the first place.

Thanks a million.
Thanks tim, i fixed it by changing news_sidebar.html to news.php

I wonder how that line changed in the first place.

Glad I could help. :)

Changing the line to
Code: Select all
<cms:pages masterpage='news.php' />
might eliminate the error. But the line itself is superfluous. It doesn't do anything.

The pages tag opens a context where you can access data related to a masterpage. This line of code, being self-closed, simply opens and immediately closes that context. It can safely be removed altogether. http://docs.couchcms.com/tags-reference/pages.html
tim wrote:
Thanks tim, i fixed it by changing news_sidebar.html to news.php

I wonder how that line changed in the first place.

Glad I could help. :)

Changing the line to
Code: Select all
<cms:pages masterpage='news.php' />
might eliminate the error. But the line itself is superfluous. It doesn't do anything.

The pages tag opens a context where you can access data related to a masterpage. This line of code, being self-closed, simply opens and immediately closes that context. It can safely be removed altogether. http://docs.couchcms.com/tags-reference/pages.html


Oh, I get your point now. Actually remove the line of code and it worked perfectly. Can't believe i was simply creating issues for myself by adding that line of code.

Thanks once more. Are you good with coding in php?
5 posts Page 1 of 1