How to override .cpt (Custom Form Controller) templates in diazo? - plone

I want to override Plone's contact-info template in a diazo based product. The contact-info is a .cpt (Custom Form Controller Template).
The recommended approach to customize .pt files for Plone 4 is to use z3c.jbot.
Is it possible in diazo to override .cpt files in a similar way like .pt files?

I'm assuming your "diazo-based product" is a design for Plone. The answer is that yes, that product can override the cpt, and the best way to do that is to use z3c.jbot.
Diazo in itself has no possibility to override templates. It works purely on the HTML that the template renders to. But there isn't any problems in including both a Diazo-based design and other features such as template overrides in the same product.

Related

How to override Liferay core' css?

Hi there i'm want to override a data picker css from a hook creation.
In Liferay Documentation 6.2 they say that it's possible with hook.
http://www.liferay.com/it/documentation/liferay-portal/6.2/development/-/ai/overriding-web-resources-with-hook-liferay-portal-6-2-dev-guide-en
But in Liferay IDE, when I create a new hook, in the interface for xml liferay-hook there isn't an option for CSS.
There are:
Portal properties
Custom JSP
Service Wrappers
Filter and Mappings
Struts Action
Indexer Post Processors
Language properties
So, how to make it? Thanks ahead!
you need to create a plugin: THEME. You can see how in this page:
https://www.liferay.com/es/documentation/liferay-portal/6.2/development/-/ai/creating-themes-and-layout-templates-liferay-portal-6-2-dev-guide-09-en
In this plugin you have a folder _diffs. Everything you put here is going to overwrite liferay´s theme.

Override Drupal Node Template

I want to change the layout of some nodes on my Drupal 7 site - namely to have the fields display across the page. In reading up on theming, they seem to be saying that in order to override node.tpl.php, I need to have my own them?
Is there a way of using an existing them (e.g. Bartik), but just simply overriding it for node layouts by using a custom node--mytype.tpl.php file?
In Drupal you can create a sub theme that extends another theme.
Yes, you can copy existing node.tpl.php and rename it to node--page.tpl.php. This template after clearing cache(Configuration->Performance) will be applyed to te nodes of type Page. Same thing you can do for Article node type with node--artcle.tpl.php or for any other. During manual update of the core to the new version theese files will not be replaced. But better to create a your own theme in 'sites/all/themes/' folder (Maybe child of Batric theme if needed).

Is it standard practice for plugins to add pages to wordpress using templates or shortcodes?

I want my plugin to add new pages to the website and I wanted to know which is the best way for doing that. I've seen plugins which add their pages using shortcodes and other plugins which include their own page templates.
I was wondering which is the better way of adding public pages (NOT AN ADMIN PAGE) to Wordpress?
both ways you described are valid . you can do both (by the way, shortcodes are just a different way to INCLUDE the template inside a post or page)
you did not specified what this template should do - but What I would do is include the template needed in the plugin folder structure, and then call it when needed , with $plugin_directory = plugin_basename(__FILE__);

Drupal: modifying a template without hacking the module

I need to edit an invoice template in Drupal (both php template and css).
I've copied pasted the file in my theme folder, as I usually do to override for blocks and pages templates, but it didn't work.
This is the template customer.itpl.php inside Ubercart/uc_orders/templates folder.
How can I override it without hacking the ubercart module ?
thanks
This template is not the normal Drupal template. In order to change it, you should create a copy of the template in the same folder (Ubercart/uc_orders/templates) and make your changes. It will show up as an option in the settings page (/admin/store/settings/orders/edit) where you specify which template to use for showing the invoice.
devel_themer is good at providing template suggestions for you. Sometimes modules uses a special naming convention.
If that doesn't help you can add your own template suggestion in a preprocess function for the template. See this post on d.o for more info.
According to the ubercart docs you should be able to specify which template files you want to use.

What is the difference between a theme and a template?

I am trying to migrate my site to Drupal and I am confused about themes and templates. The look and feel of the pages in my current site are completely controlled by template files and CSS. How does it work in Drupal?
In drupal, a theme handles the appearance of the site and a template handles how your content is rendered.
Think of it like this: the template is used to render the content, then the theme is applied on that content.
Edit: So, your css files live with the theme in drupal, and have nothing to do with the templates.
In Drupal, a "theme" is just a special type of plugin that bundles together any number of templates (to control how a given piece of data gets rendered to HTML), CSS, JS files, images, and so on.
So, there is a single "template" for your oveevral page markup, a single "template" for how a sidebar block is rendered as HTML, and so on. All of them, bundled together and named, are referred to as a theme.
Look at it this way: It's possible to create a theme that has no templates. Such a theme would have CSS files that override drupal's default CSS files. Using such a theme would create a website that looks almost exactly like Drupal's default site, except it would have different colors, fonts and so on.
But if you want to change the positions of items on the page, what kinds of items are on the page and so on, you have to override the default templates by adding some of your own to your theme. These new templates let you alter what information Drupal displays and what kind of HTML Drupal will use to display it.
For example, say I want to clone StackOverflow, but I want to do it with Drupal. First thing I would do is create a new content type (call it a "question") that is just like a story but has extra fields to track voting and so on. Drupal's default templates won't know about these extra fields, so they won't display them.
So, what I do is I go into my theme and I add a new node.tpl.php file. This new template is just like the standard one, except I can add code that says "if this node is of type 'question', insert the voting gadget to the left of the body."
Does this help?
A theme is made up of a collection of template files. block.tpl.php, node.tpl.php, page.tpl.php are all template files which when combined with your CSS, JS and images produces a theme. In addition a themes can be inherited. A theme can be created with just CSS and no additional template files by inheriting from an existing theme, in which case the template files from the parent theme are used.
Another way to look at it is a theme is what you see and the template files are responsible for generating the markup.
I hope this makes it a little bit clearer.
I'm confused...
The first answer says that templates and themes have nothing to do with each other, while the second one says themes are just collections of answers.
Which one is right?
Drupal is having a template based theming system. You can define your own regions in page and can arrange the content according to that . There are some default template file such as page.tpl ,block.tpl ,node.tpl which are displaying different kind of contents .
You can write your own template file as needed for eg if you need to alter the display of user registration form or login page you can create a tpl file for that and have to redirect the data to that tpl file. You can add the css or js to these templates using drupals apis. This redirection has to be done in the themes template.php file
A theme is comprised of css, js, images, and template files. Each theme may include multiple template files.
Additionally, themes can be inherited, and a subtheme's template files could override the template files of its parent theme.

Resources