How to edit the source code of joomla individual pages - joomla

I have a Joomla site, and I want to remove a the footer div from a page without it affecting it on the other pages. Please is there a way I can do it.

You have a couple options - you should be able to set additional CSS on that article to hide the particular footer div for that one individual page without issue.
Additionally you could install a plugin like Sourcerer that allows for PHP coding directly into articles in Joomla! (which comes in REALLY handy!); then you could remove it programmatically as well if necessarily.
Alternatively - you could create a template override for that particular template/page and edit the PHP there to reflect appropriate course of action for that URL/Page.
I tried to list them in order of easiest to most difficult.

It´s not a clean method to hide template-elements by using CSS (display:none). And for your intension you dont´t need a external plugin.
Try a page-option in your template index.php.
First - to get page-options work:
<?php $pageoption1 = JRequest::getVar( 'Itemid', '' ); $pageoption2 = JRequest::getVar( 'page', '' ); $pageoption3 = JRequest::getVar( 'option', '' ); ?>
And further:
<?php if ($pageoption1 == '1') { ?>
This text will be visible only in the page with Menu Item ID 1
<?php } ?>
This works lately in Joomla 2.5.X - for newer version i think it will also work fine.

Related

Joomla 3 category blog article override

Im trying to override the article layout for articles showing in the category blog layout. I have overriden the blog.php file from the folder components/com_content/views/category/tmpl into mytemplate/html/com_content/category, but this only overrides the category blog layout, not the layout of the actual articles.
The bit i need to override is the bit that loads inside here,
<article class="leading-<?php echo $leadingcount; ?><?php echo $item->state == 0 ? ' system-unpublished' : null; ?>" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting">
<?php
$this->item = & $item;
echo $this->loadTemplate('item');
?>
</article>
Any ideas how to do this without overriding every article on the site.
Thanks.
you should override this file:
components/com_content/views/category/tmpl/blog_item.php
Read More:
Customize Your Joomla Templates by Learning Overrides
You need to create another template over for the single article view. Place files to override from here:
components/com_content/views/articles/tmpl/
In here:
templates/myTemplate/html/com_content/article/
You can keep the names the same and every Article will use this template to render, or you can rename and manually assign the template to individual articles as needed.
Some links on the details on template overrides.
http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
http://docs.joomla.org/Understanding_Output_Overrides
http://docs.joomla.org/Layout_Overrides_in_Joomla
Try to override the following tmpl files :"category/blog_item.php", "category/default_articles.php" and "article/default.php"

Changing the position of Joomla 3.2 tags

I have added some tags and linked these to an article. On the front end the tags appear on top (i.e. before) the article text. Instead I would like to display them at the bottom (i.e. after) the article.
I assume I have to make an override of layouts/joomla/content/tags.php
Create a Template Override for the following file:
components/com_content/views/tmpl/default.php
Once done, open this file in your override location and go to line 157 and you will see the following:
<?php if ($params->get('show_tags', 1) && !empty($this->item->tags)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>
Move this section of code somewhere futher down in the file to suit your needs
Hope this helps
This can be easily achieved by simply changing the Position Of Article Info to "Below" in Options Tab in Joomla Menu. The Joomla menu has to be of Type "Article"
No need to create any override.
Hope this helps.
See attached screenshot.

display module only on the front page of virtuemart joomla 2.5

hi i want to display module only on the front page of virtuemart and dont want that module on inner pages. i have search about this, but did not get anything.
I tried to used this code but it does not effect.
<?php if (JRequest::getVar('view')=='productdetails') { ?>
<div id="productmod"><jdoc:include type="modules" name="productdetails" /></div>
<?php } ?>
Can anyone help me to figureout this problem
Thanks In advance..
take a look on the answer, and var_dump the $menuList to get all the menus, then just get the specific menu and apply your condition..
// Get default menu - JMenu object, look at JMenu api docs
$menu = JFactory::getApplication()->getMenu();
// Get menu items - array with menu items
$menuList = $menu->getMenu();
// Look through the menu structure, once you understand it
// do a loop and find the link that you need.
var_dump($menuList);
take a look on the give link how to determine the front or default page

I can't find the proper css in joomla

I need to modify the width of each column in a 2 column custom theme and can't find the place to do this. I tried using firebug but no luck. I looked over the main joomla css (didn't quite expect it to be there), and the theme template.css.
I'm sure veteran joomla programmers have ran into this plenty of times and this is an easy solve for them :P
I just need to know the places to look.
Thanks.
If you're using firebug and you still can't find the path to the css file, may be you have some kind of plugin or template that packs all your style sheets into a single file?
If so, you should disable it, clear your cache, then try again with firebug, and once you find where is the css file located, enable the plugin / template feature again.
If you still can't find it, can you post the url here to take a look?
I hope it helped!
Maybe there's no css for this.
Sometimes the width of columns in articles is inside de template itself like this:
<td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>">
<?php for ($y = 0; $y < ($this->params->get('num_intro_articles') / $this->params->get('num_columns')); $y ++) :
if ($i < $this->total && $i < ($numIntroArticles)) :
$this->item =& $this->getItem($i, $this->params);
echo $this->loadTemplate('item');
$i ++;
endif;
endfor; ?>
</td>
To find something like this code look into:
template folder/ content/ com_content / the view you want to edit (i.e. : section view, category view etc)...
Also if you use Firebug or Webkit Inspector you should see the inline style as a result of this code.
If you use firebug, you should definitely see the path of the particular css. Just right-click on some column -> click on inspect element and then you see the css path on the right-hand side.
If your column styles are set inline, you will have to modify the right template for this. Its probably your index.php in your themes root folder or some template in the html folder.

How to use headjs with Joomla?

Trying to use HeadJS in Joomla. I added a code to my template - it grabs the javascript files in the head output, prepares a string to output them between head.js code, then removes all javascript files from joomla's head output tag.
The problem is that some scripts are loaded after the template. For example, a module will enqueue some script files after the template has loaded, so its files appear outside of my head.js code. Any ideas how I can control this?
$data = $this->getHeadData();
if( $data['scripts'] ){
foreach ($data['scripts'] as $url=>$type){
if( !strstr($url, 'ajax.googleapis.com/ajax/libs/jquery') )
$headjs[] = $url;
}
unset( $data['scripts'] );
$data['scripts'][$template . '/js/head.js'] = array(
'mime' => 'text/javascript',
'defer' => false,
'async' => false);
$this->setHeadData($data);
}
And then...
<script>
head.js(
<? foreach($headjs as $script): ?>
'<?=$script?>',
<? endforeach; ?>
function(){
}
);
</script>
Different extensions can hook up to different events that are triggered during processing the output (so even after template is rendered).
Best option I found so far is creating system plugin and moving it's order to be the last of available system plugins.
Now you have two options:
use onBeforeCompileHead event (I guess introduced Joomla 1.5.23) to move scripts to headjs.
use onAfterRender event and parse head html code so it's loaded using headjs.
This is fine if you play around with async scripts loading where you have total control over the website, but it's almost impossible to implement as universal extension for Joomla. Some extensions use inline scripts in head, some in the the html body and you'd have to preserve order of execution (simple example: Mootools have to load first).
I use to load asynchronously only those scripts which I've included myself (in my template or my extension). Any scripts that are added with Joomla core (Mootools, core.js, etc.) or other extensions I don't touch.

Resources