Showing posts with label joomla. Show all posts
Showing posts with label joomla. Show all posts

Tuesday, 6 May 2014

Joomla Interview Questions and Answers

Question: What is Joomla?


joomla interview questions
Joomla is a CMS (Content Management System), used for  publishing content over the internet. User management, Content Management (like Artilces), Images mangement, Global configuration etc all inbuilt. Install and use the software.


Question: What are mambots and plugins?
Answer: A Mambot is a small, task-oriented function that intercepts content before it is displayed and manipulates it in some way. Joomla! provides a number of Mambots in the core distribution, e.g. WYSIWYG editors.In Joomla! 1.5 mambots will be renamed plugins.

Question: What are Positions?
Answer: Site templates divides the page into number of positions, each with a different name. Positions are like top, bottom, nav, header, footer, module1, module2. You can also create/update the positions from the template.


Question: What are section, categories and content items?
Answer: Contents are the html pages that is managed by admin, It may have rich text, images, css, javascript, links to internal or external pages.
Contents are categorized in categories. Means 1 category have zero or more contents pages.
Categories are categorized in section. Means 1 section have zero or more categories.




Question: Why use Joomla?
Answer: Following are benfits to use Joomla

  • It is OpenSource means download & modified at free of cost.
  • It is CMS, You can add different types of content in same or different category can be added and published on your website.
  • Thousands of Free components are available in extensions.joomla.org/
  • User Modules, User Role and permission are in built with joomla.
  • It follow MVC 
  • You can also update your old joomla from admin section.
  • Easy to development websits in joomla.
  • Various template are available at free of cost and can apply within one click.


Question: What are plugins/mambots?
Answer: These are small independent script which you can embed in your components or modules.
 It works only with some components or modules for example cck editor etc.

Question: What are Joomla modules?
Answer: Modules are small content items that can be displayed anywhere in website  by assigning positions in template.
It can be manage by module manager in admin section, there  you can install / uninstall your modules.
Few modules are Main Menu, Top menu, Template Chooser, Polls, Newsflash, Hit Counter, etc.

Question: How do I change the favicon?
Answer: You can manage favicon from configuration in Admin Section. you can upload a new favicon.

Question: What are positions in Joomla?
Answer: Site templates divides the “pages” displayed on a site into a series of positions, each
with a different name.
You can view the location of positions in your default template from the
administrator go to Site =>Preview=>Inline with Positions.
You can annotate your positions through the administrator. Go to Site=>Template Manage=>Module Positions.
You can add or remove positions by modifying your template html.


Question: What type of website, We can easily build in Joomla using extension/modules?
  1. Inventory control systems
  2. Data reporting tools
  3. Application bridges
  4. Custom product catalogs
  5. Integrated e-commerce systems
  6. Complex business directories
  7. Reservation systems
  8. Communication tools




Saturday, 31 August 2013

Joomla1.5 naming conventions, ajax, editor, datepicker, getVar, setVar, ajax, paging

Joomla naming conventions


Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone.


Joomla naming conventions, ajax, editor, datepicker, getVar, setVar, ajax, paging

List of topics which we will cover here
1) How to use ajax with Mootools.
2) How to use Calender in joomla
3) How to use Editor in joomla
4) Comman syntax which we will need.
5) Open lightbox in div/frame in joomla.
6) How to include js/css in joomla in header.
7) How to send email in joomla.
8) How to avoid confliction of mootools with jquery



1) How to use ajax in joomla
<?php JHTML::_('behavior.mootools'); ?> 
<script type="text/javascript"> 
function save_wedpro(id){ 
/*link of URL which will perform action*/
$link = 'index.php?option=com_search&task=save_wedpro&tmpl=ajax&id='+id; 
/*$('updateid') This is div which we need to update*/ 
var myXHR = new Ajax(link, {update:$('updateid')}); 
myXHR.request(); 
}

<div id="updateid"></div> 
<a href="javascript:void(0)" onClick="save_wedpro(100)">Update</a> 
</script>  



2)How to use Calender following function will load automatically all the files/function which is required for calender following will create a calender
 
<?php 
echo JHTML::_('calendar',$row->rota_date, 'name', 'id',$format = '%d-%m-%Y',array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>



3) How to use editor following function will load automatically all the files/function which is required for editor
 
<?php echo editorArea( 'editor1', stripslashes($this->row->description) , 'description', '100%;', '600', '60', '50' ) ; ?> 
You can also editor in other way It may be useful when you don't want to display the pagebreak,image,Readmore link below the editor By defaul it display all three button but if you dont't want then just declar in array array('image') means 'image' link will not be displayed
 
<?php 
$editor = & JFactory::getEditor(); 
echo $editor->display( 'description', stripslashes($this->row->description) , '100%;', '550', '75', '20', array('image') ) ; ?>


4) Comman syntax for get the value 4 parameter */ 1 para=name of filed 2 para=default value means id not found (optional) 3 para=how will get the value get/post (optional) 4 para=type of field int,string (optional)
 
<?php $id = JRequest::getVar('id', 0, 'get', 'int',); ?>
for set the value of variable and you can also set the view,layout in view.html.php or in controller
 
<?php 
JRequest::setVar('view', 'parties'); 
JRequest::setVar('layout', 'default');  ?>

how to make object of model

<?php $model =& $this->getModel(); ?>

get the login user details

<?php $my =& JFactory::getUser(); ?>

make the database object

<?php $db =& JFactory::getDBO(); ?>

instead of creating object of $my,$db you can user below also

<?php global $my,$database; ?>

//get the layout of view

$layout = $this->getLayout();
//to add the validation automatically on everypage you just need to declear below ths in view.html.php or tmpl file
<?php 
JHTML::_('behavior.formvalidation'); 
?>
Apply class 'class="required"' to text box and 'form-validate' to the form as below
<form class="form-validate"> 
<input type="text" name="business_name" id="first_name" value="" class="inputbox required" maxlength="50" /> 
</form>



5) Lightbox in Div/Frame You can use lightbox on click event also you can set its demensions i.e. height,width you can view any url in lightbox
<?php JHTML::_( 'behavior.modal' ); ?> 
<script> 
window.addEvent('domready', function() { 
//below line is very imp for open lightbox 
SqueezeBox.initialize({}); 
window.addEvent('load', function(){ 
}); 
}); 
</script>

 
lightbox in frame

<a class='modal' rel='{handler: "iframe", size: {x: 800, y: 410}}' id='modalWindowLink' href='index.php?option=com_guests&task=editparty&tmpl=component&id='>Open lightbox in frame</a>
no frame just div only
<a class='modal' id='modalWindowLink' href='index.php?option=com_guests&task=editparty&tmpl=component&id='>lightbox</a>
As i have passed "tmpl=component" in url this means that it will load only content section neither header,footer,left, right


6) How to include js/css in header from template We can control the header from tmpl file or view.html.php This will include itself files in html header
<?php 
$document = &JFactory::getDocument();
//add js/css
$document->addScript( '/media/system/js/sample.js' ); 
$document->addStyleSheet ('/media/system/css/new_style.css'); 
//add meta tags 
$document->setMetadata( 'keywords', $metaKeys );?>



7) Send email
<?php 
/* Last parameter has 1 means mail will send "html email" use 0 for "text email" */

JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message,1); 
?> 



8) Conflict jquery with mootools Joomla by default use mootools but if any reason you need to use jquery alongwith mootools Then jquery will conflict with mootools because both use "$". to avoid this problem you should me make new new object of jquery by declaring below line
 
<script type="text/javascript"> 
jq = jQuery.noConflict(); 
</script>
Now you should use jq instead of "$" for jquery;


9) How to set the joomla errros Message
$areas=JRequest::getVar("areas",'',"post"); 
//if area is empty then give a error msg in red color 
if(empty($areas)) 
{ 
JError::raiseWarning('', JText::_( 'Please select atleast one service Area')); 
//url to which u want to send 
$mainframe->redirect('index.php?option=com_user&task=edit&step=5'); 
}
-------------------------------------------------------------------------
1) Ajax with Mootools 
2) Ajax with Prototype(JQuery) 
3) Access Configuration file
4) Paging in 1.5

<?php 1)
 
window.addEvent('domready', function() { 
/* ajax alert */ 
$('ajax-alert').addEvent('click', function(event) { 
//prevent the page from changing 
event.stop(); 
//make the ajax call 
var req = new Request({ 
method: 'get', 
url: $('ajax-alert').get('href'), 
data: { 'do' : '1' }, 
onRequest: function() { alert('Request made. Please wait...'); }, 
 onComplete: function(response) { alert('Response: ' + response); } 
 }).send(); 
 });
/* ajax replace element text */
 
 $('ajax-replace').addEvent('click', function(event) { 
//prevent the page from changing 
event.stop(); 
//make the ajax call, replace text 
var req = new Request.HTML({ 
method: 'get', 
url: $('ajax-replace').get('href'), 
data: { 'do' : '1' }, 
onRequest: function() { alert('Request made. Please wait...'); }, 
update: $('message-here'), 
onComplete: function(response) { alert('Request completed successfully.'); $('message-here').setStyle('background','#fffea1'); 
} 
}).send(); 
});


2)Call an ajax and update div

 
<script type="text/javascript" src="/templates/system/js/prototype.js"></script><?php 
link = '<?php echo JRoute::_('index.php?option=com_guests&task=deleteparty&tmpl=ajax&id='); ?>' + id;

if(confirm('Are you sure to delete this task?')){ 
} 
new Ajax.Updater('updatedID',link);
 
3)create object of config


$obj=new JConfig(); 
print_r($obj);

4) Paging in Joomla

 
$limitstart=JRequest::getVar('limitstart',null,'request','int'); 
$limit=JRequest::getVar('limit',null,'request','int'); 
$query=""; 
$db->setQuery($query); 
$total = $db->getNumRows(); 
jimport('joomla.html.pagination'); 
$pagination = new JPagination( $total, $limitstart, $limit ); 
$db->setQuery( $query, $pagination->limitstart, $pagination->limit ); 
$results = $db->loadObjectList(); 
echo $this->pagination->getPagesLinks(); 


Joomla is designed to be easy to install and set up even if you're not an advanced user. Many Web hosting services offer a single-click install, getting your new site up and running in just a few minutes.

Since Joomla is so easy to use, as a Web designer or developer, you can quickly build sites for your clients. Then, with a minimal amount of instruction, you can empower your clients to easily manage their own sites themselves.

Tuesday, 6 September 2011

joomla1.5 How to set page title, meta description & meta keywords

In joomla 1.5,  How to set page title, meta description & meta keywords

Create an object
 
$document =& JFactory::getDocument(); 

Set the page title 
$page_title ='This is Page Title';
$document->setTitle($page_title ); 

Set the page description 
$page_description ='This is page descriptions'; 
$document->setDescription( $page_description); 

Set the page keywords 
$page_keywords ='This is keywords';
$document->setMetadata( 'keywords', $page_keywords);