SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Joomla 1.0

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Joomla 1.0

    Hi all please can any one advice me of how to edit meta tags for different pages in joomla 1.0
    Thanks

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    I'm guessing you're not interested in the admin or install pages. So it depends on what theme you're using.

    The few themes I looked at have a single <meta http-equiv="content-type" in the index.php file. Maybe you could simply hack that and/or add other meta tags there?

    As for Joomla 1.0 core files, these also have meta tags
    • index2.php
    • offlinebar.php
    • offline.php
    • 7 files under administrator folder
    • includes/joomla.php
    • 6 files under installation folder
    • templates/404.php


    Of particular interest is the includes/joomla.php file.
    PHP Code:
    /** @var array An array of page meta information */
    var $_head                        null;
    ......
    $this->_head = array();
    $this->_head['title']     = $GLOBALS['mosConfig_sitename'];
    $this->_head['meta']     = array();
    $this->_head['custom']     = array();
    ......
        function 
    setPageTitle$title=null ) {
            if (@
    $GLOBALS['mosConfig_pagetitles']) {
                
    $title trimhtmlspecialchars$title ) );
                
    $title stripslashes($title);
                
    $this->_head['title'] = $title $GLOBALS['mosConfig_sitename'] . ' - '$title $GLOBALS['mosConfig_sitename'];
            }
        }
    ......
        function 
    addMetaTag$name$content$prepend=''$append='' ) {
            
    $name trimhtmlspecialchars$name ) );
            
    $content trimhtmlspecialchars$content ) );
            
    $prepend trim$prepend );
            
    $append trim$append );
            
    $this->_head['meta'][] = array( $name$content$prepend$append );
        }
    ......
        function 
    appendMetaTag$name$content ) {
            
    $name trimhtmlspecialchars$name ) );
            
    $n count$this->_head['meta'] );
            for (
    $i 0$i $n$i++) {
                if (
    $this->_head['meta'][$i][0] == $name) {
                    
    $content trimhtmlspecialchars$content ) );
                    if ( 
    $content ) {
                        if ( !
    $this->_head['meta'][$i][1] ) {
                            
    $this->_head['meta'][$i][1] = $content ;
                        } else {
                            
    $this->_head['meta'][$i][1] = $content .', '$this->_head['meta'][$i][1];
                        }
                    }
                    return;
                }
            }
            
    $this->addMetaTag$name $content );
        }
    ......
        function 
    prependMetaTag$name$content ) {
            
    $name trimhtmlspecialchars$name ) );
            
    $n count$this->_head['meta'] );
            for (
    $i 0$i $n$i++) {
                if (
    $this->_head['meta'][$i][0] == $name) {
                    
    $content trimhtmlspecialchars$content ) );
                    
    $this->_head['meta'][$i][1] = $content $this->_head['meta'][$i][1];
                    return;
                }
            }
            
    $this->addMetaTag$name$content );
        }
    ......
        function 
    addCustomHeadTag$html ) {
            
    $this->_head['custom'][] = trim$html );
        }
    ......
        function 
    getHead() {
            
    $head = array();
            
    $head[] = '<title>' $this->_head['title'] . '</title>';
            foreach (
    $this->_head['meta'] as $meta) {
                if (
    $meta[2]) {
                    
    $head[] = $meta[2];
                }
                
    $head[] = '<meta name="' $meta[0] . '" content="' $meta[1] . '" />';
                if (
    $meta[3]) {
                    
    $head[] = $meta[3];
                }
            }
            foreach (
    $this->_head['custom'] as $html) {
                
    $head[] = $html;
            }
            return 
    implode"\n"$head ) . "\n";
        }
    ......
        function 
    getPageTitle() {
            return 
    $this->_head['title'];
        } 
    Do you have any experience working with these class methods? They're called in the includes/frontend.php file
    PHP Code:
        $mainframe->appendMetaTag'description'$mosConfig_MetaDesc );
        
    $mainframe->appendMetaTag'keywords'$mosConfig_MetaKeys );
        
    $mainframe->addMetaTag'Generator'$_VERSION->PRODUCT ' - ' $_VERSION->COPYRIGHT);
        
    $mainframe->addMetaTag'robots''index, follow' ); 
    So maybe you could edit that file?
    Last edited by Mittineague; May 19, 2009 at 15:01.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I appreciate your response, the ingrate I am doing this for does not appreciate all I am doing, thinks it is a matter of copying / pasting meta tags on all of the pages of joomla without recoding anything.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    The problem with that is Joomla doesn't have static pages but dynamically creates variations of "index". Perhaps if you point out the URL of the different "pages" asking them what file they think should be changed they'll "get it".

    The reason I said "you may be able to" is because it depends on what tag(s) you want to edit/add. Something that will be the same across the board will be easier. But if you want to conditionally do different tags based on the GET variables it will be more difficult.

    What are they asking for in particular?

    Does it involve any of these?
    HTML Code:
    <head>
    <title>TestSite - Home</title>
    <meta name="description" content="Joomla - the dynamic portal engine and content management system" />
    <meta name="keywords" content="Joomla, joomla" />
    <meta name="Generator" content="Joomla! - Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved." />
    <meta name="robots" content="index, follow" />
    	<link rel="shortcut icon" href="http://.../favicon.ico" />
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="http://.../template_css.css" rel="stylesheet" type="text/css" />
    </head>
    
    <head>
    <title>TestSite - First Test</title>
    <meta name="title" content="First Test" />
    <meta name="author" content="Administrator" />
    <meta name="description" content="Joomla - the dynamic portal engine and content management system" />
    <meta name="keywords" content="Joomla, joomla" />
    <meta name="Generator" content="Joomla! - Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved." />
    <meta name="robots" content="index, follow" />
    	<link rel="shortcut icon" href="http://.../favicon.ico" />
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="http://.../template_css.css" rel="stylesheet" type="text/css" />
    </head>
    
    <head>
    <title>TestSite - Contact</title>
    <meta name="description" content="Joomla - the dynamic portal engine and content management system" />
    <meta name="keywords" content="Joomla, joomla" />
    <meta name="Generator" content="Joomla! - Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved." />
    <meta name="robots" content="index, follow" />
    	<link rel="shortcut icon" href="http://.../favicon.ico" />
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="http://.../template_css.css" rel="stylesheet" type="text/css" />
    </head>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •