Categories
drupal

Drupal Custom pager and Display suite

When enabling a Display Suite layout, your custom pagers will disappear.
This can easily be resolved using a node display custom field.
The custom field feature is great and allows for very powerful stuff and it lets you get around most issues.

I’ll provide the solution first and explain later as this can be used to bring in content from other custom modules that add content to the node.

The solution

Get the pager details:
1. Go to Home › Site building › Custom pagers (admin/build/custom_pagers)
2. Edit the custom pager and make note of the ID its in the URL admin/build/custom_pagers/edit/1 (pager id = 1)
3. set the pager position to Above the Node body (you will be able to position it using Display Suite wherever you want)
4. Hit the submit to save changes

Add the Node display field
1) Go to Home › Site building › Display suite › Node displays (admin/build/ds/nd/fields )
2) Expend the “Add new code field”
3) Giver it a key and title. Make those specific to the pager so something like custom_gallery_pager and custom gallery pager
4) Set the content type the field is relevant to in the “Field exclude” section. you must check all types except the one you are interested in (reverse logic)
5) And finely add the “Field code”
content['custom_pager_top'][1]["#value"]; ?>
Replace [1] with the relevant pager id you (Get the pager details stage 2) and Save

You an now use your field in your DS layout (:

Analysis

Modules that add content to a node would usually add it in the nodeapi to the node content so the first place to look is the node api of the module.
Below is an extract

function custom_pagers_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
case 'view':
// We want to make sure we don't try to output when print.module is active.
// It's a bit of special casing but it doesn't do much harm.
if ($teaser == FALSE && empty($node->printing)) {
......................
switch ($pager->position) {
case 'top':
$node->content['custom_pager_top'][$pager->pid] = array('#value' => theme('custom_pager', $nav_array, $node, $pager, 'top'));
break;
case 'bottom':

its easy to see how the code adds the content. It does this by creating a new array element according to the $pager->position.
In the case of ‘top’ this is:
$node->content['custom_pager_top'][$pager->pid] = array('#value' => theme('custom_pager', $nav_array, $node, $pager, 'top'));
so the ‘#value’ will hold the actual pager giving us (for pager id 1):
$node->content['custom_pager_top'][1]["#value"]
when using node display fields you must replace the $node variable with $object so the filed code is
content['custom_pager_top'][1]["#value"]; ?>

Categories
CMS Technology WordPress

Automatic population of the Word Press Database

Automatic population Word Press Database

See Expression Engine Entities, db structure data import and performance for a the related discussion this was part of.

I illustrated how you can create relatively powerful systems with the simple WordPress database modal by populating the database directly using a back end system driven by a well structure data modal.

You do this by creating navigation using the creation maintenance of categories for navigating the relationship, and at every level you can create automatically generated post representing the deferent entities in the database. While the result will be a very de normalized view of the data and can be impossible to maintain through the word press interface it can easily be done by maintaining the structured back end and updating the word press databse.

It is even possible to allow for two way system buy queering posts that have not been auto generated by the back end system.

While I am not advocating this is the perfect way it is a technique that can be used to develop a powerful front end with very little investment.

It can also be used to publish a system to various different front-ends, so you may have a powerful proprietary web site but may want to support varies other interfaces driven by the same data like Web Press blogs white labeling a subset on your system.

Guy Shneerson

Categories
CMS ExpressionEngine Technology

Expression Engine Entities, db structure data import and performance

4th March 2010, not far from Corn Exchange, Brighton

I met my mate Adam from http://www.engaging.net/ and we had an interesting session looking into various aspect of the Expression Engine architecture.

Expression Engine Entities and db structure:

We looked at how its ability to define entities is reflected in the database structure where Expression Engine entities are not created as database entities (DB tables) but instead as record entries in a table, we touched on the possible approaches to a CMS database design touching on issues like advantages of a normalized database with the difficult of creating a CMS that needs to handle an unknown database schema.

Data importing and populating:

We also talked about approaches to populating the Expression Engine MySQL DB from other database and I illustrated the approach to developing a tool that would allow you to import data from normalized databases by interrogating a DB schema. Adam has told me he has had quite a bit of work importing data from people who have given up on Joomla. I pointed out that if Joomla takes the same approach as expression Engine and has no proper normalized architecture it will need a specific implementation of a data import tool.

We also talked about importing data from other sources like web sites and XML and how that can be done using the scripting language I have developed with George Boobyer for blue-bag this language is especially designed for fast visual design of data extraction and transformation for HTML, XML, SOAP and databases.

Adam also showed me his product External Entries allowing EE systems to integrate with none EE MySQL databases

Performance:

We talked about the database as a possible bottleneck especially one like the Expression Engine that duo to its flat nature is not optimized for performance (please correct me if you think you I am wrong). Adam talked about the various tools/approaches that can be used to cash Expression Engine by converting pages or elements with in them to static HTML using  Apache htaccess files.

We also had a chat of a few other technologies like:

  • Ruby on rails Ruby on Rails (Rails or RoR) as a Web application framework
  • Python
  • Django a high-level Python Web framework
  • Pylons a Ruby, Python and Perl web framework

Hopefully next time we can expend on those more

Look out soon for similar session covering the drupal architecture

Guy Shneerson

Categories
CMS drupal Technology

Some usfull drupal links

http://drupal.org/ The main drupal site

http://groups.drupal.org/ Is part of the drupal.org group of sites. groups.drupal.org serves the Drupal community by providing a place for groups to organize

http://drupal.org/project/gmap Drupals gmap Module. The GMap module provides an interface to the Google Maps API within Drupal.

http://www.chicagoancestors.org/ an example of using Drupal.gmap

http://drupal.org/project/ubercart Ubercart Ubercart is an e-commerce suite developed for Drupal.

http://livetest.ubercart.org/uc1/ Ubercart 1.x livetest: showcasing droople Ubercart

Categories
CMS Technology WordPress

Useful WordPress Plugins

I find the following plugins useful as a set of default plugins for a WordPress installation:

  • ultimate-google-analytics – requires an analytics account (free) and really is the ultimate SEO plugin;
  • google-sitemap-generator – generates a Google Site map (useful with a Google Webmaster Account);
  • platinum-seo-pack – Manages Title tags and meta tags along with loads of other SEO tools;
  • revision-control – controls (limits)  the number f revisions you accumulate;
  • WPTouch – Provides an iPhone interface to your blog.
  • Akismet – Comes with WordPress  – activate it – it works and really stops a lot of comment spam.

I load all of these by default with WordPress installations. The SEO ones really enable you to manage and monitor the visibility of your site and to track traffic.

Enjoy!