Creating dynamic drupal pages with panels
Standard drupal content types can be quite flexible. It's easy to add new fields of various kinds ranging from integers, urls and text, to node references and user references. Fundamentally though, there comes a point where a given page needs more than a single piece of content - no matter how spiffy said content is.
Look at any content driven site such as news or article websites and, almost without exception, they'll have regions showing different bits of content on their landing page. It's easy to mimic this with your own Drupal website, no programming required - all you need is the Panels module.
As per the Panels page:
"The Panels module allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout..."
One of the most powerful features of panels is that it integrates with views and other modules, allowing you to add virtually any type of content to any part of a panel page. To create a new panel (first download, install and enable the module):
- Go to the Panels dashboard under Site building in the admin section and click Create new... Panel page
- Give the page a name, machine name and brief description. If you want this panel to be the landing page, check the Make this your site home page option and then click Continue
- Select a layout and click Continue - the layouts represent how the page will divided up into regions. Each region can hold any number of content blocks.
- Add a title if required and click Finish
That all there is to it. You now have a new panels page complete with regions, but of course... no content. In order to begin adding content:
- Go to the content layout page - this displays a graphical representation of the regions on that panel page.
- Click a gear icon (at the top left of each region) and select Add content
- Choose what content to add from the Add content overlay. This could be anything from custom code, to an existing node, to views, widgets and pretty much anything else that exists on the site
- Complete the add content configuration and click Finish
- The content layout interface will now display the new content within a draggable box. Content can be dragged from one region to another or reordered by dragging up and down the list
- Repeat this process until you have all the content you want added to the page and then click Update and save
With the new panel saved, it is now possible to browse to it by going to the page path you specified at the start of the process. With all the content in place the next task becomes formatting and layout. Panels provides options (by clicking the gear icon) to style each individual block or region, and you can use CSS to implement any class or ID attributes you add.
A good working example of a panels page is the Site prebuilder homepage. As you can see this page has a number of different elements, providing a variety of different features and content.
"Bestselling author of development, eCommerce and marketing books." ~ Wikipedia
I am a serial entrepreneur and startup founder. I also consult to huge corporates and SMEs - providing insight and experience that relates business objectives to technical, analytical, Internet marketing, and SEO solutions. Tell me what your business needs; and I'll make it so.
"World class content, business, SEO & Internet marketing services!"
David Mercer
Get the weekly expertise, strategies & tips you need to succeed online!
Current projects
OO PHP Web service ACO solution to TSP
Building an OO PHP web service application using ACO (Ant colony optimization) as a stochastic and heuristic way to solve the TSP (Traveling Salesman Problem) for the UK vehicle and fleet tracking firm 3D Tracking.
"Doctoral level maths, OOP, PHP and ants. Having nightmares about ants... ;)"
PHP and Views customizations for Drupal startup
Doing some heavy Views and PHP customizations for an SA startup called ZAPlayGround (not yet launched). Just worked out that Views won't pick up taxonomy terms from URL (path) aliases in organic group contextual block.
Provided a PHP default argument script to manually generate the path alias from the NID.
"It's working! Now to clone the view and away we go."
Business, marketing, SEO, social web analysis
Large corporate - NDA'd. Looking at business requirements, and how to improve the workflow with regards to creating social and SEO marketing content in the most efficient way. Complex requirements. Lots of stakeholders.
"Always interesting working with large organizations. Getting things done requires approval in triplicate ;)"



















