Showing posts with label article. Show all posts
Showing posts with label article. Show all posts

Tuesday, March 20, 2012

Extending Joomla Article Search

The following tutorial will let you know how to extend joomla's default search to add fields of content that are not searched by default, for example 'created_by_alias'. The files mentioned are from Joomla 2.5, previous versions will be quite same.

Following are the things you need to do:
File: plugins\search\content\content.php

You have to add the field in two places, the 'select', and 'where', to add to 'where' look for swtich option at line 73 having cases 'exact' and then below 'all'/'default', add a line for your field like:
$wheres2[] = 'a.created_by_alias LIKE '.$word;


Then moving to 'select' fields like in line 153 and 210:
$query->select('a.title AS title, a.metadesc, a.metakey, a.created AS created');


and add your field like
$query->select('a.title AS title, a.created_by_alias, a.metadesc, a.metakey, a.created AS created');

And finally you need to add your field in the function "searchHelper::checkNoHTML" at the end of the file:
searchHelper::checkNoHTML($article, $searchText, array('text', 'title','metadesc', 'metakey')
to
searchHelper::checkNoHTML($article, $searchText, array('text', 'title','created_by_alias', 'metadesc', 'metakey')



Thursday, March 8, 2012

Disable article text/description in Joomla 2.5

In category blog layout you see articles with their text / description. If you want to disable articles text in category blog layout what you need to follow the following steps:

1. Go to 'Content'
2. Select 'Options'
3. Switch to tab 'Blog Featured/Layouts'
4. Set first 3 columns to 0 and forth (links) column to whatever value you want which will only show the links to the articles of the category.









PS: I have renamed 'Article' to 'Book' in my site so don't get confused with the image :)

Set Default Article Category Joomla 2.5

Are you wondering how to set default category joomla 2.5 for the article and can't find it in the article options? Well then you are looking at the wrong place. To set the default category for users who are adding articles from the front end, you can set the default category from the 'Menu Item'... Menu item is the options available for all the options/links added into 'Menu(s)' of Joomla.







When you add a new field in lets say main menu named 'Add Article', you will see that a Menu Item has also been created for it in the new tab called 'Menu Items', once you go into its options you can easily set a default category so users add all articles into the specified category. You can have different default categories for different menu options.