Custom Webform Page Layout in Drupal 6 - drupal

I recently finished building an intranet site with Drupal 6 (client mandated the older version) using the Zen theme. The site contains several (20+) survey pages made with Webform.
Client wants to change the layout of the webform pages to have a full width content area and no sidebar. I found that I can make a custom template page named "page-node-53.tpl.php" and that will work on ONLY node/53. This would be fine if I only had one Webform page.
Is it possible to make a custom layout page and somehow assign it to only the webform nodes? This can easily be done in Wordpress... just wondering if there's an easy way to do it in Drupal? Thanks!

I figured it out...
First, I changed the name of the custom template file to "page-webform.tpl.php".
Next, I added the following code to the top of page.tpl.php before the DOCTYPE declaration:
<?php if ($node->type == 'webform') {include 'page-webform.tpl.php'; return; } ?>
It appears to have worked! Every page is unchanged except the pages that feature a Webform.

Related

Wordpress custom template on every new page (Elementor)

I have wordpress and am using Elementor editor. I have added a page that is meant to be a template for each new pages. I added a block with breadcrumbs to this page. I want this page with breadcrumbs on evey new page that i create. Copying this page all the time creates problems, e.g. if I wanted to change something in this block so I must do this on every subpage. I do not know how to do it - all i want its one static page with that breadcrumbs that includes to every new page i create, and when im change something in this page, changes will appear on every page.
Help :( Photo below
https://i.stack.imgur.com/G1EyI.png
Use the "Template" block in Elementor
That is achievable with Elementor Pro using theme builder option.
Create that template as a single page template and then in display options choose to display it on all pages.
Creating a Single Page Template with Elementor Pro
Then you should use standard page editor or custom fields to put content that is then going to be rendered by the template.
Doing that will let you make changes on all pages at once by editing the template.

Easiest way to implement a temporary page to a Drupal 7 site

I'm a WordPress developer who's been tasked to create a temporary one-pager to a Drupal site. The client would like to have a simple front page with a logo and 4 external links until their new site is ready. Normally I'd just make a simple index.html page with some CSS and call it a day. But in this case they need some of the sub-pages from the Drupal site to continue to work.
Had it been a WordPress site, I would have just created a new template file and a new page inside WordPress, and made that the front page. But as I have zero experience with Drupal, I don't know if you can do the same thing here.
What is the easiest (quickest) way to make a simple splash-page as the front page, while having the rest of the drupal site continue to work? The splash-page should ignore all CSS and JS from the original theme — preferably have a completely independant section fromt the rest of the site.
In Drupal 7 you have few "levels" of templates. First you have "most outer" template html.tpl.php It contains html head and it is usually common for all pages.
Then inside that html.tpl.php you'll include page.tpl.php. That one should again contain some common page elements, as header and footer, but again, if your design requires that, you can have more than one page template.
Page template will include node template. In drupal you have 2 basic content (node) types but you can create many more of them. Basically for every different page layout you can create new content type (but there also are lot of different ways to achieve the same thing).
Basically you should create new content type called i.e. "splash" (machine name!). Add fields to it if they need to be back-end editable.
Then you should create new template file for your content type. Name matters, so you should call it node--splash.tpl.php . You can find and copy to your theme existing node.tpl.php and change it to your needs.
Keep in mind that when ever you add/remove new template file you have to clear the cache so drupal would scan theme directory, notice and start using new templates.
And if you need also different page template for you page you'll have to put some code into you tamplate.php file:
https://www.digett.com/insights/overriding-page-templates-content-type-drupal-7
Drupal template engine design an specific file name for override front page.
You can create the file html--front.tpl.php, and this will be used only for the front page without touch any other page. You can page here your custom HTML and reference css/js.
If the page you need share common styles with the rest of the site, I would recommend to instead override page--front.tpl.php which is basically the content of the page without the tags
For more information here is a link https://www.drupal.org/docs/7/theming/howto/customize-the-front-page-template

How to make a sitefinity master page without ASP.NET?

The company I am working for has a sitefinity. They want me to create custom pages from scratch for them. I have never used sitefinity, so upon research It appears that I want to create a template via .master. Then once built, I would add to my CMS and access it for use.
Is there a way to make these .master templates other than ASP.NET? ( which I have no experience with)
Essentially all am am wanting to do is create a custom page out of html,css, and jquery and then make a 'template' out of it.
You dont have to use a .master page to create a template in Sitefinity. It's nice to have that level of control but it's not necessary at all. Just go to Design > Page Templates in the Sitefinity backend section /Sitefinity
There are several built in templates you can edit from that page. You can use one of those templates, create a new template from scratch, or create a template based on any one of the templates you see there.
Once you pick a template, you can edit the Layout to add columns and global content or custom CSS.
Not really, if you want control over the markup then you'll have to use a .master page but the good news is that it really is just mostly html and css / js references. Sitefinity has a sample template here but you may want to look at their Visual Studio plugin called Thunder to register a template. It will add in a default master page as well as the default folder structure for the theme, video on that here.

How to create fully reusable layout page template in wordpress?

For all pages, Wordpress give us a default page template : page.php. That's clear and simple, by default all pages use this template. Then, Wordpress give us a page template system, and when we speak about template we think reusable so we think about page layout template.
For example : full-width, page-width, sidebar-left... You specifie the template to use for each page, it's ok.
But when you begin to work on a more complex web site, your content will not be a simple post (page type) inside a page template anymore. For a reason or another you have to use another feature of Wordpress : page-slug.php. Before, of course you can try to do shortcode for everything you develop, include specific plugins only for your complex page etc but ONE DAY, you will have no choice to use this page-slug.php.
Here comes the problem : the content is "more specific and complex" but you still need to use your layout template, and you can't... Of course, you hate duplicated code so you don't want to just "copy" your template inside.
If we really want a specific page, we use the page-slug.php without a page template and it do the job. Then...
Why Wordpress don't consider the page-slug.php as pure content when (and only when) a page template is specified ?
Am I missing something ?
Thanks

Template is lost on pagination Drupal 6

I have a site created in Drupal 6 and am having problems with a particular page.
The page uses a specific content type (type_a). This has it's own page template (page-type_a.tpl.php) This all works fine.
I've then added a view onto that page using views_embed_view(). This view has pagination.
The first page looks great (URL = /my-page), the template is right, the view appear and so does the pagination.
However when I select another page on the pagination the page reloads correctly (URL - /my-page?page=2) all the content is correct, the node data is there as is the new page of the view. However this page has now fallen back to the default page template.
Anyone know how I might get around this?
Thanks
You can add template suggestions in your preprocess_page function to have it always use any template for a chosen url.

Resources