Creating a quick tips block and page view

I often have a lot of small bits of info I'd like recorded but can't write anything worthy of full entry for.

I considered creating a module to create a small entry type that is displayed randomly in a block with a link to a full page listing of these short entries.

Instead of doing this I created a content type (quick_tips) and set its workflow settings uncheck published as I do not want these entries considered as full pages.

I then added a field 'active' with a content type of text - select list - with two values ('no','yes') defaulting to no. This will be used in views to only show those we want shown.

Now I created one entry using this type so I had something to work with while building my view.

view building screenshot


Click for larger

 I created the view with the base rules of

Fields: Title and Body

Filters: 
         Node:Type = Quick Types
         Content: Active  = Yes (The custom field from the quick types content type)

Now I created a block and page view as each one will have slightly different rules. (When editing settings on the block or page view make sure to select override or the changes will take place for the entire view.)

Default
Added a Header: Quick TIps

Block
Sort Criteria
Global: Random
Items Per Page: 1
Caching: Per page (I don't want the display to change on page refreshes)
I also edited the body output to include a link to the quicktips page. I could have also added a footer and placed the link in there.

Page
Sort Criteria
Node: Nid Desc
Itemes Per Page: 5
Path quicktips

Next I copied my page.tpl.php to page.quicktips.tpl.php so I could manually set the title and meta description. I'll have to add more once I go beyond 1 page to keep from getting duplicate titles / meta descriptions.

I now need 2 entries to see of the block random is working and up to 6 to test the page view.

I still might go with a custom module as there are a few things missing I wanted to add that aren't possible with cck and views.

Comments

alterations

After adding a second quick tip entry to test the block I noticed some problems. I had turned on caching for blocks and wanted this block to be cached so as not to change on every page refresh. But a few tests showed that it was changing for every page view.
The ajax pager did not work instead linked back to the page being viewed with a page=1 (or other number) which messes with seo as they are plain text links bots will follow.
So I turned off paging all together and changed the random sort for the block to the same as the page view.
Now only the newest will be shown with a more link to the page view.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
7 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.