Drupal 7 theme "front" differs from other pages - php

I need a custom template for the 'frontpage' and a custom template for all the other pages.
What are the best practices to accomplish this?
Do I need to make 2 themes or can I use the same theme?

Create 2 template files:
page--front.tpl.php for the front page.
page.tpl.php for other pages.
For further reading, check out Drupal 7 Template Suggestions.
Don't forget to clear the site cache after the creation of each new template file.
Hope this helps... Muhammad.

If you're new to Drupal theming, try using the Devel and the Themer Developer module (http://drupal.org/project/devel_themer)

I would like to direct you towards "The Drupal Way" (do it with flexible UI-based modules) if you are not already familiar with.
I would approach this problem using Panels and possibly Views if you need to display listed information on the page (such as a news-feed or similar).
This gives a whole different approach to setting up your site's content displays and it is the general direction of the Drupal ecosystem.

Related

how to apply different layouts to different pages in Drupal 7?

I have converted a HTML page to Drupal template by using blocks and page.tpl.php file. Now I have another page that I need to convert and link it to the main navigation menu.
The problem is, that another page have completely different layouts and I don't understand how to create that layout and link it to the main menu. Is it really so complex? I found that it can be done by using panels but I am completely new in Drupal. I need a simple solution. Thanks if anyone can help me.
You can use some module like display suite or panels to create custom new pages with custom layout.
If you want to make all with code (and avoid database configurations), panels module is fully compatible with features (I don't know compatibility with display suite).

Making a dynamic website using core HTML/CSS and PHP or Wordpress

I have to make a dynamic site for my assignment, the site must have an admin panel where the owner of the site can change certain visual elements that will be specified by them.
Now the question is will I have to use core PHP HTML/CSS to do this entirely?
Will Wordpress provide any help in this situation?
I have read people making sites using Wordpress so will this help me regarding my situation?
WordPress is a CMS. You'll have a lot of control over the content, and can add additional control by use of Custom Post Types (CPT) and taxonomies.
There are lots of themes you can use and extend by use of child themes, or you could either build your own from scratch or use a starter theme (I would recommend Underscores).
You can, of course, roll your own using HTML, CSS, JavaScript and PHP, but it is a lot more work.
WordPress is a simple and user-friendly solution for your issue but if you want to avanced custom the admin panel for each user or each group user you must use Drupal : https://www.drupal.org
Yes, definitely WordPress is what you need. There are other solutions like Joomla, Drupal also available but I would suggest to use WordPress though. Using it wou may create your own widgets and specify areas which you want to allow administrator to edit. So basically if WordPress theme is done right the end result will be very good using WordPress.

How to create themes in yii framework?

I am new to Yii framework. I was working on drupal earlier, and the theming of drupal made sites are not difficult to manage. But I just want to know that how to create theme for the site with Yii framework.
I have gone through many sites, but still don't know where to start. For example I have checked http://www.yiiframework.com/doc/guide/1.1/en/topics.theming.
Now my doubts are:
Where to start for creating Yii themes? Suppose I want to change drupal theme to Yii, How can I do this?
Is it possible to have different theme for different pages? Like in drupal by using themekey module, we can have multiple theme for different pages.
It will be good if anybody will explain it step by step.
You can edit the layouts (protected/views/layouts/..). These are the wrapper views which are rendered around individual views rendered with render(), for example the site/index calls the index view (located at protected/views/index.php) using:
$this->render("index");
You can change the layout per action using:
$this->layout = "differentlayout";
You can set the layout for all actions within a Controller using:
public $layout='//layouts/differentlayout';
Obviously each layout can have a custom structure and loads different CSS and JS files. I know this isn't using the themes and theming but it is by far the most common way of customizing the look and feel of a Yii project
Here are some helpful links regarding YII theme development:
http://www.yiiframework.com/doc/guide/1.1/en/basics.view
http://www.yiiframework.com/wiki/249/understanding-the-view-rendering-flow/
http://mushfiq.me/2011/05/30/creating-a-yii-application-theme-from-a-html-template/
you can always download some of the simpler Yii Themes and see how they work.
--iM

How can I edit a default function on WordPress?

I should edit the dynamic_sidebar() function on wordpress (hiding some categories, editing the template).
Is it possible? I read "you need to edit the core", but I don't have understand where is this "core" :)
Never edit the core. The reason is that if you change the default behaviour, themes you install might not work and updates to the wordpress engine will break your changes.
To change the way your wordpress behaves, create a child theme. Then add a functions.php file and in it create a widget that has your desired behaviour.
You can also register a new type of sidebar and a page templates that shows only that type of sidebar.
See: http://codex.wordpress.org/Child_Themes and https://codex.wordpress.org/Function_Reference/register_sidebar_widget
Personally, you sound like your just starting out so I will give you some advice. Never edit the core.
It's tempting for a quick fix. Everyone has done it when they didn't know any better, but you have the opportunity to learn the right way.
Approach your problem logically. What are you trying to edit it for? Hiding some categories? Use the internal widget system in the CMS and take them off. Delete the categories, or hide them with CSS {display:none;}.
Good luck my young Padawan. I hope you take some advice and heed it well.
Best way is to probably make a Child template using the plugin One-click child theme. Copy the file containing the function to the child template (using ftp) and edit it there. This way you can update your template and still keep your changes.

Add custom content to a wordpress theme template

I'm in the process of customising a theme (styling, css, etc). However, I ran into a small problem, basically I wan't to include an introductory message at the top of the home/index template, and then have it as an option(text area) in the theme options panel. How do I go about doing this. Sorry for the noobish question, haven't found any straightforward solution yet. Thanks.
This is a significant customization that will require changes to the PHP code for the theme. You need a PHP programmer, preferably one who knows WordPress.

Categories