Display a Drupal page without the page template - drupal

Hello I am trying to generate a Drupal node which would be similar to a feed page generated by views module. I need to generate an xml feed, so I would not want to show the regular drupal template that is showed up on every node. I am trying to understand how the views for feed works as I want to display my page in a similar fashion, without the drupal template. Any suggestions would be great.

In Drupal you can theme any individual page to be completely different than the default template. So, if you have a node, let's say the url is "node/14", you can create a new template file called "page-node-14.tpl.php" in your theme folder. In this template you can add any html/xml markup you need. Also, for that specific node you should also create a "node-14.tpl.php" to theme that node's content.
If you want to display more nodes on a page, something like "taxonomy/term/3" (here you can find all nodes tagged with the term with the ID 3), you have to create a "page-taxonomy-term-3.tpl.php" template in your theme folder. To theme every node from one particular content type, you should create a "node-news.tpl.php" (this is for news node types) in your theme folder.
Please keep in mind that these template suggestions are for Drupal 6. In Drupal 7, the template name changed from "node-news.tpl.php" to "node--news.tpl.php"

Related

How to create subpages for taxonomy term page in wordpress?

I have created a custom taxonomy and what the term page will look like.
domain.com/taxonomy/term
But for each taxonomy term, I have included various custom fields and included content. The content is large and I want to display them in subpages with individual link clicks. I want to display them in subpages.
For eg:
domain.com/taxonomy/term/meta-data-1
domain.com/taxonomy/term/meta-data-2
How can I create this?
I am using Genesis Framework
I'm assuming you have some knowledge in php and Wordpress theming.
You could create/add a custom-subterm then create a specific template for that custom-subterm called taxonomy-custom-subterm.php.
Inside you could display all relevant informations/metadata to the custom-term.
If your custom-taxonomy is set to hierachical (which is the default behaviour I believe), then the url should be /custom-taxonomy/custom-term/custom-subterm/.
Graphical representation
domain.com/
L custom-taxonomy/
L custom-term/ (using taxonomy.php OR taxonomy-custom-term.php as template)
L custom-subterm/ (using taxonomy-custom-subterm.php as template)
This is based around the default Wordpress hierarchy.
Learn more # https://developer.wordpress.org/themes/basics/template-hierarchy/.
And # https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23-00.20.04.png

How create different page for every different posts in wordpress?

I am developing a website where I am required to have individual pages for every different posts. I have to put 8 posts in eight different styles and properties, that is why I need those pages.
For example as we know for each page template we can make something like
page-templateone.php
Like that I want something similar for posts, just for example:
post-numberone.php
You can create a following php file in your theme folder
single-{post_type}-{post_slug}.php
For example, you have a post with a slug very-important-post. To have a template for this post alone, you need to create a file called single-post-very-important-post.php
If you'd like to be able to select template from the post editing screen, in 4.7 post type templates became available. Read more here
If you'd like to be able to do it in the older verion, take a look here

Drupal 7: How to theme nodes based on region?

How do I control the output of a node rendered inside a specific region?
Inside Sidebar First, I can theme blocks by creating a block--sidebar-first.tpl.php template file. However, creating a node--sidebar-first.tpl.php does not work.
Unfortunately, Drupal doesn't have support to have node template based on region. You can check out this link.
If you want to achieve your goal you can use Display Suite module. Here are some screen-casts about how to control your content with Display Suite. Here's also a comment about this.
For theming a node first thing you need a custom node template file.
Inorder to do that copy your node.tpl.php and rename it as node-[ur_node_name].tpl.php .
Now you have created a custom node template. In case of blog entry my node name would be node-blog.tpl.php [Drupal-6] and it would be node--blog.tpl.php [Drupal-7].
NOTE:
Make sure the [ur_node_name] part is the machine readable name.Now in your new node template give your corresponding styles and print the contents of the node.This is how you theme a node.Hope this helps you... :)

Drupal 6 custom page templates fighting each other

I have a page template: page-lcds.tpl.php which works for the www.xxx.com/lcds page.
But, it also gets used for /lcds/2-4in and /lcds/5-10in and etc.
So I could create a page-lcds-2-4in.tpl.php but then I'd have to create all the others for each category.
All of these pages are actual custom Pages content-type.
Is there a better way/place to specify a page template just for "page-lcds" and then use the regular page.tpl.php file for all other lcds/*?
I think, you should treat LCD as category instead of content type.
So, create a vocabulary called "Product type" & add "LCD","LED" terms to it.
Now, you can do category theming under page-taxonomy-term.tpl.php
and node theming under page-node-<custom-content-type>.tpl.php

Drupal Views2 Exposed Form

A while back you commented on a poster's question for how to alter the Drupal Views2 Exposed Form. In the post you mentioned:
The proper way of changing the theme would be to override the views-exposed-form.tpl file in your theme's folder. Bear in mind that this will apply to all exposed filter forms, to theme a specific one, you will need to use a different name for that filename, like:
views-exposed-form--TITLE--DISPLAY.tpl.php views-exposed-form--TITLE.tpl.php
and some others, you can check the Theme: Information section of your views for template naming conventions.
Can you expand on what the 'TITLE' and 'DISPLAY' are exactly? Are both template files needed or just one of them?
Thanks.
I am not the author of the post you are referring to, but I can answer this question.
The way Views theming works is that there is a base template for a specific part of the output and this base template can be made more specific by adding additional qualifiers to it.
If you copied /sites/all/modules/views/theme/views-exposed-form.tpl.php to your theme folder (or from wherever you have Views installed), made changes to the copy, and then edited your view and chose Theme: Information and clicked Rescan Template Files, Views would now use this template in your theme folder for rendering the exposed filters form. This is the base template name and so it will be used for every view's exposed filters form.
If the change you're making should be applied to every exposed filters form then you're done. However you probably want to limit this overriden template file to specific views or even specific displays of specific views. If you want to apply the template only to a view named testview then you could rename your theme's views-exposed-form.tpl.php to views-exposed-form--testview.tpl.php. Don't forget to use the Rescan Template Files button after each rename or new file. Now that template only applies to the view testview and all of its displays.
A view can have multiple displays - maybe a block, a page, a page for admins, etc. These are listed vertically down the left side of the edit page for a view. You can get more specific and target a particular display of a particular view. To do this, you might name this template file views-exposed-form--testview--page-1.tpl.php which would cause it only to be used for the testview view and only for the first page display of that view. You can find the display name by hovering over the tab - it will appear at the end of the URL your browser shows in the status (default, page_1, etc). Just remember to turn underscores to hyphens in the template filenames: use page-1 not page_1.
You can also target all pages for example: views-exposed-form--testview--page.tpl.php.
These naming conventions as well as a list of templates which can be overriden are available here: http://views.doc.logrus.com/ (click Views Template Files).
So, if you have a specific display or view where you want to override the default template then you only need a single file targeted for that combination. If you need to target additional views or display combinations, you will have more files.
You can try Views exposed form layout module for views exposed form theming.

Resources