0

It mightbe a lame question but I want to be able to display a custom page let say: "/news".

So, I created a template named: page--news.tpl.php with my content, some rendered views etc. Now when I got to this address, I can see my requested content however there are two problems: - title of the page is "Page not found" - the search form does not work.

Could anyone explain what is going on? I am on Drupal 7.

BTW. My template contain some html and this section to embed another view:

        <div class="col-md-8">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h1 class="panel-title">News</h1>
                </div>
                <div class="panel-body">
                        <?php echo views_embed_view('news_view_block_more', $display_id = 'block'); ?>
                </div>
            </div>
       </div>

Thank you

0

If you have created a node, for instance a "Page" node, by going to "Content" => "Add Content", AND have the Path or Pathauto module enabled, you can give that node the path "news" when you are editing it. Alternately, you can create a view that is a page, and has that path.

Specifically, the Drupal menu router has to have an entry for the path "news", and know what to serve up. Blocks and templates don't create that path entry.

More information on creating content can be found at: https://www.drupal.org/node/120635

  • Thanks.I created a view page with apath "/news". I also renamed the template to "views-view--news.tpl.php"; cleared the cache and now the page cannot be found at all. My question still is why the why I did it before leads to a proper content loading with the two quirks I mentioned. – kwicher Aug 29 '14 at 0:05
  • To help troubleshoot, can you post a screenshot of the view? – faerysteel Aug 29 '14 at 15:23
  • I included the part of the template. Still my question stands: how come that when I create page--news.tpl.php (not a view) and got to "/news", I see intended content but with "Page not found" title and broken search. – kwicher Aug 29 '14 at 19:25
  • you get that effect because there are two elements at play. The menu router which tries to show content can't because you haven't assigned any to that path, but the template engine still recognizes the page - since you manually insert the content, the content shows. start by getting rid of the tpl file, create the view, assign the menu to /news and make sure it shows correctly. – Geoff Aug 30 '14 at 19:54
  • If it doesn't, there are other issues at play. If it does, re-assign the tpl - you may need to include the type of view in the name (views-view-unformatted--news.tpl.php). make sure this file contains DEFAULT information to start - if it isn't set to display the default behaviour, it won't show anything and probably give an error. Once you have a working tpl with default behaviour, you can then start manipulating it. – Geoff Aug 30 '14 at 19:54
0

Have you tried taking a look at page-manager with a view for example? Or is the content you are trying to display so specific that this is not possible?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.