Slogan LiveZilla Live Help

The skeleton file Index.php - Part 6

With the help of Notepad + + for example, create a new file called index.php in it and insert the following skeleton:

    <?php defined( '_VALID_MOS' ) or die( 'Restricted access' );
    $iso = explode( '=', _ISO );
    echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

        <head>

            <?php mosShowHead(); ?>
            <?php if ( $my->id ) {initEditor(); } ?>
            <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
            <link href="/<?php echo $mosConfig_live_site;?>/templates/<?php echo $GLOBALS[cur_template];?>/css/template_css.css" rel="stylesheet" type="text/css" />

        </head>
        <body>


        </body>

    </html>

Explanation of the tag <link>

Between <head> and </ head>, it indicates index.php file in the CSS file to search, and with the tag <link />. The attribute "href" of this tag indicates the location of your worksheet template_css.css.

The tag <link />, initially has the following form: <link style = "http://localhost/MonSitePerso \ Templates \ TemplatePerso \ css \ template_css.css" rel = "stylesheet" type = "text / css" />

Using Joomla variables in place of the folder names and file, we can generalize the tag and make it valid for any template.

Joomla! has the variable $ GLOBALS [cur_template] which returns the name of the template and the variable $ mosConfig_live_site which contains the address of the site.

The tag becomes /> <link after replacing the contents of variables by the names of variables:
<link href = "<? php echo $ mosConfig_live_site;> / templates / <? php echo $ GLOBALS [cur_template ];?>/ css / template_css.css" rel = "stylesheet" type = "text / css" />

In doing so, the skeleton of your index.php file will be valid whatever the name of the site and all your future templates. The code in this way is well optimized.

Comments

Name *
Email (For verification & Replies)
URL
Code   
Submit Comment
button_logo_portfolio
button_quote
button_testimonials

Subscribe Tutorials

Enter your email address:

Paypal Donation

Enter Amount:

Subscribe Joomla Tutorials Newsletter

Name:

Email:


Enter your email address: