By drupray on
I'm looking to leave Joomla, on my current Joomla site I display client testimonials in blocks on various pages. When the page is refreshed the block is updated automatically to show another testimonial.
I can't find anything that does this in Drupal.... been searching.....
Any ideas? PHP coding is a none starter, I have no experience of coding.
TIA
Comments
You have to use PHP
Its the only way. I'm afraid. However, if you browse the PHP snippets section of the Handbook you should be able to find what you need. I have used the following code to randomly select a quote from a list of them:
The trick here is that all the quotes are nodes created with a new content type (no CCK used, just regular 5.1). This makes it easier to find them. The other way is to use taxonomy and tag each quote with a specific term. However, that route requires a join in the SQL, making it a bit slower than the above code. If you need to use taxonomy check the PHP snippets for something.
HTH
______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development
______________________________________________________________________________________________________
AJAX Newsflash, now available!
Hi, I come from Joomla too. That's why I know your pain :) while migrating to Drupal.
One of my client request Newsflash feature too, so you can use the real Newsflash module here:
http://drupal.org/project/ajax_newsflash
This is not only regular Newsflash but has AJAX support!
No PHP required - Create a CCK type and random block view
What I would do is create a CCK type called "Tesimonial"
First you'll need a few modules... go ahead and install/enable: CCK, and Views (these are "nearly core" modules which you'll use to do many many things in Drupal - must haves for every Drupal site). I also recommend Pathauto (which in turn requires Token). Since you're new and might not know, here's how to install modules: Installing contributed modules. Make sure to enable all of the CCK and Views checkboxes on the modules screen to enable all the features.
The following steps may seem complicated at first, but once you get used to it you'll appreciate how much power and flexibility it gives you, all without knowing any PHP.
Once all of the modules are fully enabled, look in the Administer menu and go to Administer -> Content Management -> Content Types (yoursite.com/admin/content/types if you have Pathauto module on). Click on "Add content type" at the top. Type "Testimonial" for both Name and Type (lowercase for the Type one). The rest of the options depend on your needs - I'd uncheck "Promoted to front page" unless you want that to happen (probably not), and Disable comments. Leave the Title and Body field label as is. When done, press "Save Content Type". If you need them, at this point you can also add additional fields to the form (click List then click Edit next to Testimonials, then Add Field), but that can get a bit more involved, so let me know if you need more.
Now look again at your menu... go to Create Content -> Testimonials. Fill out a few demo testimonials for testing right now (or enter some real data if you have it).
Now it's time to create a View to print out the Testimonials exactly how you need them. Go to Administer -> Site Building -> Views (yoursite.com/admin/build/views) and click "Add" at the top. Type a name and description (this is for internal use not display) and leave Access alone. Then open up the "Block" fieldset. Check "Provide Block". For View Type you'll choose what's most appropriate for your needs - I like to choose List View myself, which exports the fields as a simple unordered list in the XHTML, allowing me to style them easily in my CSS (though this option is only available if you add custom fields). You might prefer Teaser List in this case (or Full Node if you will always be displaying the full testimonial... whereas teaser would display a certain amount then a link to view the rest). Set Nodes per block to 1. Then move down the the "Filters" fieldset. Under "Add Filter" choose Node: Published from the dropdown and press the Add Filter button. Then repeat, this time choosing Node: Type. It will add Node: Type above, and you should click on Testimonial in the list.
Lastly we'll set up the "Randomizer" to show a random testimonial with each page view. Click the "Sort Criteria" fieldset and choose Random and Add Criteria.
After all these settings have been made, you'll click Save at the very bottom.
Now all that remains is to pick how and where this new block you've created will be displayed on your site. To do this, go to Administer -> Site Building -> Blocks (yoursite.com/admin/build/block). Look down in the Disabled area and you should see a block available now called Testimonials. Choose a Region (such as your right or left side bar) and a weight if you want it to display in a certain order), and press Save Blocks. The Testimonials block will now move up into the Region you specified, and you can click Configure next to the block to set more options if you need them (such as allowing it to display on only certain pages or sections). If you need even more precise theming of the elements that make up the fields you're printing out, you can use Contemplate to override the theming at a more granular level.
View your site and see if your new block appears as expected. You might have to go back and tweak a few things to get it just right. If you want to set up a custom template around this kind of block (different than other blocks, such as the menu, etc).... in your theme directory (e.g. yoursite.com/themes/garland if you're using Garland, or in sites/all/themes if you have your own theme) copy the block.tpl.php file and make a duplicate of it in your themes directory renamed block-views-testimonials.tpl.php - you can then edit how just that type of block looks without affecting all the others.
One last thing you'll likely want to do in this case... since it's a testimonial, you probably won't want to display the "submitted by Username on date" text that appears by default below the title and above the text of the testimonial (since you'll probably be entering this info with your own account). The best way to remove this on a per-content-type basis, go to Administer -> Themes and click Configure at the top (yoursite.com/admin/build/themes/settings). This brings you to to the Global Settings for all the themes on your site. You'll see an area called "Display post information on" with a list of all your content types. Uncheck the box next to Testimonial, and press "Save Configuration".
Anyhow.... I hope this helps. Master the techniques here and you'll be well on your way to making very customized/advanced things with Drupal with little or no programming knowledge required.
-- Dave
That's cool
keyz, that's a great tutorial - definitely learned something there. I'm not a huge fan of Views (or CCK for that matter), but they are definitely useful modules. I had no idea there was a random sort criteria.
______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development
______________________________________________________________________________________________________
Master the techniques here
Master the techniques here and you'll be well on your way to making very customized/advanced things with Drupal with little or no programming knowledge required.Thanks for a thought-provoking tutorial. A little bit rubbed off, and made me more curious about Drupal, in comparison with Joomla.
Is there no "[quote] ... [/quote]" capability in this forum?
Does this forum use the "core" Drupal forum, or a third-party product?
----
Jack.
Good to hear :)
Good to hear :)
Yes, Drupal.org uses the stock unmodified (to my knowledge) forum module that comes with Drupal core... its features are sparse compared to full-fledged forum software (much too sparse in my opinion haha), but it can be extended with a variety of other modules. There's evidently an install profile in the works to automate the setup of all those additions, though I haven't tried it - you can also add just the pieces you need on your own - there's a pretty good list here: http://groups.drupal.org/node/2418 (and check out the full DruBB group as well). It looks like Drupal 6 will also ease some of the pain in custom theming Drupal forums.
Even with all that it won't have the everything-but-the-kitchen-sink level of features in vBulletin or the like (which most people don't need), but it "will" have tight integration with Drupal and a consistent end-user experience throughout the site. If you do really need the features, the best bet is a "bridge" with an external forum - for the high end the best options is a near-complete project called Drupaltin (and there are integrations for free forum software too, though I haven't tried them). Or let me know if it's something you want to pool resources on - I'm considering spending some $ to get more features developed for Drupal's forums in the future.
Regarding quote tags... nope not by default, but there is an add-on that adds the functionality: http://drupal.org/project/quote
This is different compared to the "other" quotes module mentioned earlier in this discussion: http://drupal.org/project/quotes (which facilitates adding random quotations to pages).
Definitely spend a bit of time playing with Views, CCK (and it's many add-on field types), Panels module (try the 2.0 alpha release - amazing). Get a very good kickstart in theming here: http://www.drupaldojo.com/lesson/theming-like-a-pro
Good luck! :)
-- Dave
absolutecross.com
nice writing
nice writing
Wowww u are so cool Keyz!
Wowww u are so cool Keyz! very very cool! thanks for all of ur goodness :)
How about this
How about this module?
Quotes - http://drupal.org/project/quotes
Subscribing
Subscribed.