简体   繁体   中英

CSS for web pages in joomla

I am new to web design. I use Joomla 3 to create a bookshop website. I have designed my homepage the way I like using CSS, the problem is that i want to style other web pages on the website but i cant.

I am using a self made barebones template that has an index.php file and a style.css file. The CSS code I used for the homepage is in the style.css file. I need to create another css file for pages such as "about page" of the website so i can style it the way i want but I don't know how to do this.

The main menu has the following links: home, about us, text books, literature books, stationary, etc

Below is a snapshot of my index.php file.

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$doc = JFactory::getDocument();
$doc->addStyleSheet($this->baseurl . '/media/jui/css/bootstrap.min.css'); /* to add bootstrap */
$doc->addStyleSheet($this->baseurl . '/media/jui/css/bootstrap-responsive.css'); /* to add     bootstrap responsiveness */
$doc->addStyleSheet('templates/' . $this->template . '/css/style.css');
$doc->addScript('/templates/' . $this->template . '/js/main.js', 'text/javascript');

?>
<!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" xml:lang="<?php echo $this->language; ?>" lang="<?php     echo $this->language; ?>" >

<html>
<head>
<jdoc:include type="head" />

</head>

<body>
<div class='header'></div>
<!-- main container -->
<div class='main_container'> 

    <!-- Main Menu -->
        <div class='logo_main_menu'> 
            <div class='logo'> 
            </div>
            <div class='main_menu'> 
            <jdoc:include type="modules" name="position-7" style="well" />
            </div>

There can be unique cases where you need/desire several templates running on one Joomla install. You could create an additional bare bones template, install, and then assign via template manager.

In template manager, you can assign a different template on every single page of your website.

So the solution you may be looking for would be to have a couple different templates to run your separate pages.

Using the following code you can determine the front page and other pages and apply the changes required for each page.

ref: https://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page

How to determine if the user is viewing the front page

There are some differences in 1.6/1.7/2.5 to avoid Strict Standards errors. Use the following code for a site where all content is in the same language:

 <?php $app = JFactory::getApplication(); $menu = $app->getMenu(); if ($menu->getActive() == $menu->getDefault()) { echo 'This is the front page'; } ?> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM