Handling RSS feeds with Drupal View Module
This is a great way to pull information from an RSS feed… Spot on ‘Drews’!
Tips and snippets for Drupal
This is a great way to pull information from an RSS feed… Spot on ‘Drews’!
If you have a Drupal 6 site, and need to secure a page so only users logged in can see it, do the following…
if(user_is_logged_in() != TRUE){ // Do stuff, i.e. // header('Location: /'); // exit('You do not have permission to view this page, please log in with the correct access.'); }
This makes use of the Drupal 6 function user_is_logged_in()
This can also be used in the page.tpl with a page title, (which uses the $title variable)…
Oh yes, this one is vital, and the thinking behind the steps involved can be applied to achieve other vital functionality…
http://thewichitacomputerguy.com/blog/email-drupal-comments-approval-admin-email-address
If you need to create custom pages that use $_SESSION or even access the database via your standard PHP MySQL calls, you can ‘piggyback’ your Drupal site using the $title variable in the page.tpl.php page…
I’ve used this technique many times to do everything from adding a page called by AJAX, to whole password protected member areas with it’s own set of database tables…
In it’s simplest form, first add a node so Drupal has something we can catch, (in English, create a page titled ‘Test’… Note I’ve used a capital ‘T’).
It’s easy to think that you can’t use $_SESSION in Drupal as it’s configured in a different way to a normal PHP site…
I haven’t looked into it in-depth, but the ‘user’ table in the database shows how visitors to the site are seen. The first in the table is empty with an I’d of zero… This represents ‘anonymous’ users… The visitors SessionID is also stored in the database…
So you can see why if you add a custom page to your site, the standard PHP Session call doesn’t work…
… And that’s where some people stop…
When using ‘table’ as the display mode in Drupal views module, I noticed the settings I set under ‘sort’ were being ignored.
If you click the icon next to ‘table’ you open the configuration box. Here you can choose the order and there’s also a tickbox that is set to override your ‘sort’ settings it’s ticked as default, which isn’t very helpful, but once you know where it is, you’re back in control.
I don’t often use the table style in Drupals View module, but it is great if you just need, well a table list of content…
The other day I needed such a display to show a list of upcoming events, and for some reason, I didn’t have any tags.
After some head scratching, I realised that the tags used when creating your fields, (i.e. Title:) also become yourtags.
Normally I use views to display a different type of content, so normally I delete the standard tags.
Another splendid idea from Mark Jackson (MJ Digital). This loops through the database and replaces a certain string with another… Ideal is a site name has been changed…. Or I use it when a Drupal site goes live and needs to be switched from the test site (on a subdomain) to the live domain…
Recently improved by Eric Amundson, who has taken the script and added an easy to use front end. Between them they have released it under the GPL in the hope it may help more people.
Great explanation of how to get Dreamweaver to colour code other file types as PHP, i.e. .module or .install
The instructions are for a recent version (CS5 I think), but the technique is the same for older versions as I'm still using Dreamweaver 8...
http://fronterahouse.com/blog/news/color-code-tpl-or-inc-files-as-php-with-dreamweaver/