Filed under: Technology

Drupal Custom pager and Display suite

When enabling a Display Suite layout the 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.

Ill 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 exept 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"]; ?>

Leave a Comment November 9, 2010

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

Leave a Comment March 5, 2010

Enterprise Thursday presenting Dr. Aleks Krotoski

Enterprise Thursday presenting Dr. Aleks Krotoski

4th March 2010, Corn Exchange, Brighton

Enterprise Thursdays (Sussex University) presents Big Breaks in the Digital Age” Discover how to make it big in the media world – keynote talk by BBC TV’s “Virtual Revolution” presenter Dr. Aleks Krotoski.

After a great session covering Expression Engines architecture me and Adam made our way back to the corn exchange in Brighton looking forward to Aleks’s talk. I was a bit worried that the place will be over packed but luckily it was just perfect with a nice number of people and enough free chairs, not only we had a sit but food and nice wine was available (with all the excitement of the day I dint have much to eat so spot on).

Aleks or as she amusingly enjoys hearing Dr. Aleks talked about the journey that got her were she is today. Her story telling was great and with out bothering to spell it out Aleks’s story illustrated many of the topics that where illustrated in the Wired Sussex Media Jobs + Skills Fair 2010 earlier session.

The talk was followed by a Questions & Answers session, and the questions asked where surprisingly good (and why not? you say, and right you are I answer) and her answers where inspiring (I am in an over excited mood about technology lately but it really was).

Some of the topics I found especially interesting where

Her view on “leveling technologies” involving emerging markets like China Africa as the internet access sweeps the globe (that’s probably as far from her own words as can be but its how I remember it) I especially found that inspiring as: while I lost hope for society as a whole to rectify the many social injustices it created, I still believe that the internet can provide an opportunity for individuals and on line communities to make more then a symbolic change (So now I am both over pessimistic and over optimistic at the same time).

She also talked about many aspects of social networking ranging from the use of branding, the ability of social networks to create a fake sense of ownership & about how successful social media takes a long term approach.

Aleks Krotoski made a bold and interesting statement about facebook being on its way out. My understanding of this is that she referred to on-line communities as a relatively new concept, and as people get used to it they will expect it to mature and reflect more closely their view of real social networks supporting smaller groups i.e. I don’t have 15,000 friends but I only have 10 close friends maybe a 100 other friends 100 people I know through work and another few hundreds online associations. She didn’t actually say all that, its just my interpretation (so if anyone got it from another angle let me know). The way I see it in the Friend Face of the future it may be incredibly rude to ask a complete stranger for friendship.

Some useful links for Dr. Aleks Krotoski :

Aleks Krotoski  http://alekskrotoski.com/

The guardian    http://www.guardian.co.uk/profile/alekskrotoski

Twitter                http://twitter.com/Aleksk

Guy Shneerson

Leave a Comment March 5, 2010

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

3 Comments March 5, 2010

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

Leave a Comment March 3, 2010

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!

Leave a Comment March 3, 2010

apple mac software

Some free some not apple mac software/utils, those I’ve paid for were worth it in my opinion:

Continue 1 Comment March 1, 2010


Calendar

November 2017
M T W T F S S
« Nov    
 12345
6789101112
13141516171819
20212223242526
27282930  

Archives

Categories