Posts Tagged ‘drupal’
Drupal multiple Views on same page
Last Updated on Wednesday, 11 November 2009 08:03 Written by Simon Nicol Friday, 9 October 2009 05:19
If you’re using Drupal 6.x and you need to display multiple ‘Views’ on your homepage (or any other page for that matter) here’s the code that will do it for you…
In this example I will be displaying the View called ‘showcase’, just change it to whatever name you called your View. The only text you need to change is highlited in red.
You can paste this code into your page.tpl.php file for as many Views as you need!
<?php $viewname = 'showcase'; $display_id = 'showcase'; // or any other display $args = array(); $args [0] = 'foo'; // These values are optional $args [1] = 'bar'; $view = views_get_view($viewname); $view->set_display($display_id); $view->set_arguments($args); print $view->preview(); ?>
If you just want to display a View without passing in any variables (args) then you can simply have:
<?php
$viewname = 'showcase';
$display_id = 'showcase'; // or any other display
$view = views_get_view($viewname);
$view->set_display($display_id);
print $view->preview();
?>
Boom! Job done.
All the best
Simon
Tags: drupal | Posted under Articles & Reviews | 2 Comments
Cron on Windows
Last Updated on Wednesday, 11 November 2009 08:03 Written by Simon Nicol Saturday, 3 October 2009 03:32
If you’re running cron on your server you will need to setup a scheduled task that will effectively call the cron.php file for your domain.
You can simply do START > RUN
schtasks /create /tn “Drupal Cron Job” /tr “php -f ‘{path-to-cron}/cron.php’” /sc hourly
So for my Astrophysics website the command would be:
schtasks /create /tn "Drupal Cron Job" /tr "php -f 'http://manonmars.co.uk/cron.php'" /sc hourly
You will then need to type in the administrator password.
Job done, or should I say ‘cron done’
Tags: drupal | Posted under Articles & Reviews | No Comments
Devel block not appearing.
Last Updated on Wednesday, 11 November 2009 08:03 Written by Simon Nicol Wednesday, 30 September 2009 01:14
Here is a serious case of the Devel block not working:
I’m having the same problem. If I enable the Devel module it does not get listed in ‘Blocks’ where I should be able to drag it from ‘disabled’ to one of my side bars.
I’ve even gone to the extent of removing all modules (except Devel)I have run update.php, flushed all caches, run cron and everything comes up clean – no errors whatsoever.
I go again into into modules where I have ONLY ‘core optional’, ‘core required’ and ‘Devel 6.x-1.18′(as of 30/09/09 the latest version) that’s all. I have unticked and saved configuration then re-ticked Devel and saved configuration and still nothing.
When I go into Blocks (In the Garland theme) I have:
Left Sidebar
Navigation
User loginFooter
Powered by DrupalDisabled
Execute PHP
Primary Links
Secondary Links
Switch User
Syndicate
Who’s Online
Who’s NewAnd that’s it. There simply isn’t a ‘Development’ block listed. I have tried this with multiple themes and the Development block just simply isn’t there. How is it possible I’m missing something when the Devel module is the only one insalled? Everything I can think of has been checked and re-checked and still the Development block can not,does not, and just WILL NOT appear!
I am not excluding the fact that I’m probably working too many hours at the moment, but to completely eliminate every conceivable possibility I’m even happy to provide anyone from Devel a temporary URL to this site with the Admin Username/Password and I’m pretty sure they will have as little success as I’ve had.
Having now stripped everything down to it’s utter minimum all that is left for me to do now is to backup my site’s theme and start the whole site again from scratch – The only problem here is – what happens when/if this happens again?
Yup, that quote was made by me on the Drupal.org website. Seeing as I’ve only just posted it I haven’t had a reply yet, but to anyone else who’s experiencing a serious problem with their Devel block I would recommend double checking there are no conflicts with DHTML or the Administrator block – because you might be able to solve your problem. But if you’ve had about as much luck as I have in stripping your site down to absolutely nothing and still it doesn’t work, I would at this point suggest that the Devel module still had a serious bug problem.
Will keep you posted!
Tags: drupal | Posted under Articles & Reviews | No Comments
Drupal mailhandler smtp localhost error
Last Updated on Wednesday, 11 November 2009 08:04 Written by Simon Nicol Tuesday, 29 September 2009 03:29
As you know I always write my own technical articles and tutorials. However on this occasion I have come across an article that is so well written and the instructions (if followed) work so smoothly that there is nothing I have to say that I could add to make it any better.
If you have just installed mailhandler for Drupal and you would like to use it with GMail you may have come across a bunch of errors along the lines of:
Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in… and the like.
There are some other errors I’ve seen along the lines of ‘check the file includes\mail.inc line 194′ that were reported by Drupal. Well I checked the the mail.inc folder and lo and behold there was no function of the correct name and it certainly wasn’t on line 194…
Anyway to cut a long post short I hate Microsoft Exchange – it’s an over bloated overly complex, un spam filtered pile of pap and it also costs money to.
The answer is to use GMail (Google Apps) which is completely free, very stable, highly available, spam filtered and uses SSL.
If you’re running a Windows server with PHP you’ll find that the php.ini file doesn’t support SSL/TLS and a number of other things – That’s where this article comes in. Check it out!
Also check out this article for receiving mail to your Drupal site using mailhandler here:
http://www.willisbros.net/blog/2007/11/06/want-to-use-drupals-mailhandler-module-with-gmail/
Tags: drupal | Posted under Articles & Reviews | No Comments
Hot Topics
- WordPress Contact Form 7 & WP-Mail-SMTP problem solved
- Creating a Drupal 6 custom login form – Step by Step tutorial.
- How to take Ownership of a Drive, Folder or File in Windows 7
- How to check if Google Analytics is working correctly.
- IE emulator for FireFox
- Firefox – update favicon.ico (SOLVED)
- imagecache wrong path – SOLVED!
- 7129/6105195 Edward Leedskalnin’s anti-gravity – How he built Coral Castle.
- WordPress widgets not saving or dragging?
- IIS7 – No HTTP redirect icon
Archives
- May 2012
- February 2012
- November 2011
- September 2011
- August 2011
- June 2011
- January 2011
- December 2010
- November 2010
- October 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- January 2009
- December 2008
- August 2008
- June 2008