We have a problem with the following Joomla! 3.1 site:
http://www.kurapotheke-igls.at/
There are two css files included by the :
<link rel="stylesheet" href="//media/jui/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="//media/jui/css/bootstrap-responsive.css" type="text/css" />
Here the path is wrong, there are two slashes in the front which shouldn't be there. I testet it with YSlow and this two files causes the extreme loading time of the site.
Strange is also, when I look at the website code this two files are included twice:
<link rel="stylesheet" href="http://www.kurapotheke-igls.at/media/jui/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="http://www.kurapotheke-igls.at/media/jui/css/bootstrap-responsive.css" type="text/css" />
<link rel="stylesheet" href="//media/jui/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="//media/jui/css/bootstrap-responsive.css" type="text/css" />
Here is the code of the index.php file:
<?php
defined('_JEXEC') or die;
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->language = $doc->language;
// Add current user information
$user = JFactory::getUser();
// Add Bootstrap Framework
JHtml::_('bootstrap.framework');
JHtml::_('stylesheet', JUri::root() . 'media/jui/css/bootstrap.min.css');
JHtml::_('stylesheet', JUri::root() . 'media/jui/css/bootstrap-responsive.css');
// Add page class suffix
$itemid = JRequest::getVar('Itemid');
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getItem($itemid);
$params = $menu->getParams( $active->id );
$pageclass = $params->get( 'pageclass_sfx' );
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<jdoc:include type="head" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Stylesheets -->
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/icons/css/font-awesome.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/css/k2style.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/css/joomla.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/css/template.css" type="text/css" />
<!-- Styles -->
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/styles/<?php echo $this->params->get('templateStyles'); ?>.css" type="text/css" />
<?php if (isset($_GET['style'])) { $styles = $_GET['style']; }
if (isset($styles)) { ?>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/styles/style<?php
if ($styles == '1') {echo '1';} elseif ($styles == '2') {echo '2';} elseif ($styles == '3') {echo '3';} elseif ($styles == '4') {echo '4';} elseif ($styles == '5') {echo '5';} elseif ($styles == '6') {echo '6';} elseif ($styles == '7') {echo '7';} elseif ($styles == '8') {echo '8';} elseif ($styles == '9') {echo '9';} elseif ($styles == '10') {echo '10';} ?>.css" type="text/css" /> <?php }
else { echo ""; } ?>
<!-- Google Font -->
<link href='http://fonts.googleapis.com/css?family=<?php echo ($this->params->get('googleFont')) ? $this->params->get('googleFont') : "Open+Sans"; ?>' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=<?php echo ($this->params->get('textLogoGoogleFont')) ? $this->params->get('textLogoGoogleFont') : "Open+Sans"; ?>' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<?php // Parameters
require("admin/params.php"); ?>
<?php // Google Analytics Tracking Code
if($analyticsCode) {echo '<script type="text/javascript">'; echo $analyticsCode; echo '</script>';}?>
<script src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/backtop/backtop.js"></script>
</head>
Do you have any idea why joomla includes this wrong files?
I had the same error, in my case a module published in the home page was trying to load the bootstrap.min.css, but the php file of that module was misspelled. The path was whit a slash before the media directory, generating the link to //media/jui...
Try searching in your modules code for "/media/jui/css/bootstrap.min.css" and remove the slash. It works for me.
JHTML::stylesheet('media/jui/css/bootstrap.min.css');
Addstylesheet has to contain the full URL path, unless it is linked to from the template.
So $doc->addStyleSheet(JUri::base().'media/jui/css/bootstrap.min.css'); should work.
Ref: http://docs.joomla.org/J3.x:Adding_JavaScript_and_CSS_to_the_page
I believe from a template you can just use $this-> and a relative URL, ie $this->addStyleSheet('media/jui/css/bootstrap.min.css');
Ref: http://docs.joomla.org/JDocument/addStyleSheet
Try using the following instead which makes use of Joomla's JHtml method.
So replace this:
$doc->addStyleSheet('media/jui/css/bootstrap.min.css');
$doc->addStyleSheet('media/jui/css/bootstrap-responsive.css');
with this:
JHtml::_('stylesheet', JUri::root() . 'media/jui/css/bootstrap.min.css');
JHtml::_('stylesheet', JUri::root() . 'media/jui/css/bootstrap-responsive.css');
Related
I have a syntax error in my index.php in lines 35 and 49. How can I fix it? My website shows the following error message
" ERROR
WHOOPS! WE'VE GOT A PROBLEM
syntax error, unexpected end of file
The page you were looking for doesn't exist. Sorry about that."
Here is the code:
<?php
/**
* Copyright (c) Extensionsforjoomla.com - E4J - Templates for Joomla
*
* You should have received a copy of the License
* along with this program. If not, see <https://e4j.com/>.
*
* For any bug, error please contact us
* We will try to fix it.
*
* Extensionsforjoomla.com - All Rights Reserved
*
*/
$doc = JFactory::getDocument();
include('./templates/'.$this->template.'/config/colswitch.php');
$doc->addStyleSheet('templates/' . $this->template . '/css/bootstrap/bootstrap.css');
?>
<!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; ?>" class="client-nojs">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$css_string;
$menutitle = $this->params->get('mobiletext');
$get_less = $this->params->get('enabless');
?>
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/general.css" type="text/css" />
<script>localStorage.clear(); </script>
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/templateskit.css" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/js/templateskit.js"></script>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="true">
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/main.css" type="text/css" />
<?php include('./templates/'.$this->template.'/blocks/config.php'); ?>
<?php if(
You haven't closed the last if statement.
<?php if(
I am currently using a template file called single-product.php and want to check for page template in header.php. I've tried using get_page_template_slug($post->ID) but it returns empty. I've also tried is_page_template('single-product.php'); but that returns nothing, as well.
Here's my header. You'll notice that I'm trying to get the template file through s_page_template('single-product.php') ny setting it as the value of $isProductPodTemplate at the top and use it in the if statement at the bottom:
<?php
$page = get_the_title($post->ID);
$frontpageId = get_option('page_on_front');
$isStandardTemplate = is_page_template('standard.php');
$isContactTemplate = is_page_template('contact.php');
$isProductPodTemplate = is_page_template('single-product.php');
?>
<!DOCTYPE html>
<html id="mainHTML" lang="en">
<head>
<title>Architectural Iron Works</title>
<meta name="description" content="Architectural Iron Works">
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel=icon type="img/ico" href=/favicon.ico> -->
<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_directory_uri(); ?>/main.bundle.css" />
<link href="https://fonts.googleapis.com/css?family=Poiret+One" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<?php wp_head(); ?>
<script type="text/javascript">
document.getElementById("mainHTML").style.display = "none";
</script>
</head>
<body>
<!-- Header -->
<?php
if ($post->ID == $frontpageId)
{
get_template_part('/includes/_home-header');
echo "<div class='main-content'>";
}
else if (is_404() ||
$isContactTemplate ||
$isStandardTemplate)
{
get_template_part('/includes/_no-banner-header');
echo "<div class='main-content no-banner'>";
}
else if ($isProductPodTemplate)
{
// do something
}
else
{
get_template_part('/includes/_default-header');
echo "<div class='main-content'>";
}
?>
I'm building a custom theme in Wordpress and I need to add a CSS attribute to the body tag when the URL ends in ?checklist-view=1
What is wrong with my code below, since no fullscreen is being added?
I understand that I need to use the superglobal $_GET, however I'm completely new to PHP.
Is there an easier way to do this with the body_class template tag (like im trying below) or is this something that would require more complicated PHP
EDIT: Changed $class to equal a string and not have it set to an array.
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0">
<title>Process Street <?php wp_title(); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_stylesheet_uri(); ?>bower_components/html5shiv/dist/html5shiv.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<?php
//?checklist-view=1
$is_checklist = $_GET['checklist-view'];
$class= 'fullscreen';
if($is_checklist == '1') {
echo $class;
}
?>
<body <?php body_class($class); ?>>
You shouldn't echo the class but, rather, you should just assign it to the variable to be passed to body_class() later. I'd also check whether or not checklist-view is set, to avoid errors:
<?php
$is_checklist = $_GET['checklist-view'];
if ( !empty( $is_checklist ) && $is_checklist === '1') {
$class= 'fullscreen';
} else {
$class = '';
}
?>
<body <?php body_class($class); ?>>
You can also achieve the same thing with the ternary operator:
$checklist = $_GET['checklist-view'];
$class = ( !empty( $checklist ) && $checklist === '1') ? 'fullscreen' : '';
?>
<body <?php body_class($class); ?>>
I am including fetch_header.php in header.php
When I included a file, code is working properly.
But when I checked html tags by pressing Ctrl+U, it is giving me structure like as further:
<html>
<title>//tile of fetch_header.php</tile>
<head>//head of fetch_header.php</head>
<body>//body of fetch_header.php</body>
</html>
<html>
<title>//tile of header.php.php</tile>
<head>//head of header.php.php</head>
<body>//body of header.php.php</body>
</html>
html tags are repeating. How to overcome on this issue.?
<?php global $theme; ?><!DOCTYPE html>
<?php
include_once "fetch_header.php";
function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php $theme->hook('meta'); ?>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/reset.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/defaults.css" type="text/css" media="screen, projection" />
<!--[if lt IE 8]><link rel="stylesheet" href="<?php /*echo THEMATER_URL*/; ?>/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen, projection" />
<?php if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); } ?>
<?php wp_head(); ?>
<?php $theme->hook('head'); ?>
<!-- bxSlider Javascript file -->
<script src="<?php echo THEMATER_URL; ?>/bxslider/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="<?php echo THEMATER_URL; ?>/bxslider/jquery.bxslider.css" rel="stylesheet" />
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,500' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/custom.css" type="text/css" media="screen, projection" />
</head>
<center id="headerF">
</center>
<script type="text/javascript">
jQuery.noConflict();
</script>
<body <?php body_class(); ?>>
<?php $theme->hook('html_before'); ?>
<div id="container">
<?php if($theme->display('menu_primary')) { ?>
<div class="clearfix">
<?php $theme->hook('menu_primary'); ?>
</div>
<?php } ?>
<?php if($theme->display('menu_secondary')) { ?>
<div class="clearfix">
<?php $theme->hook('menu_secondary'); ?>
</div>
<?php } ?>
Use include_once "fetch_header.php";
replace all include"fetch_header.php" toinclude_once "fetch_header.php"`
I have edited code as further :
<?php global $theme; ?><!DOCTYPE html>
<?php function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<?php
$data = file_get_contents('http://cgi.ebay.in/ws/eBayISAPI.dll?GlobalHeader&headertype=FULL:HOMEPAGE');
// require_once "fetch_header.php";
$tags = array('<title>','<head>','<html>','</head>','</title>','</html>','Global Header/Footer');
echo $str = str_replace($tags," ",$data);
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Try this one.
require_once("fetch_header.php");
I'm trying to apply my own Theme made with jQuery Mobile Themeroller to my Wordpress Theme. But somehow it won't apply.
Here is my header.php code
<!DOCTYPE html>
<html>
<head>
<title>
<?php
if (function_exists('is_tag') && is_tag()) {
single_tag_title("Tag Archive for ""); echo '" - '; }
elseif (is_archive()) {
wp_title(''); echo ' Archive - '; }
elseif (is_search()) {
echo 'Search for "'.wp_specialchars($s).'" - '; }
elseif (!(is_404()) && (is_single()) || (is_page())) {
wp_title(''); echo ' - '; }
elseif (is_404()) {
echo 'Not Found - '; }
if (is_home()) {
bloginfo('name'); echo ' - '; bloginfo('description'); }
else {
bloginfo('name'); }
if ($paged>1) {
echo ' - page '. $paged; }
?>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon-precomposed" href="<?php bloginfo('template_url'); ?>/img/icon.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php bloginfo('template_url'); ?>/img/icon-ipad.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php bloginfo('template_url'); ?>/img/icon-iphone4.png" />
<link rel="apple-touch-startup-image" href="<?php bloginfo('template_url'); ?>/img/splash.png" />
<link rel="apple-touch-startup-image" sizes="640x920" href="<?php bloginfo('template_url'); ?>/img/splash-iphone4.png" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" href="themes/CustomTheme.min.css" />
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<?php
wp_head();
?>
</head>
<body <?php body_class(); ?>>
Also tried the the custom css before the jQM CSS and the code that is given with Theme.zip when you download it at themeroller
<link rel="stylesheet" href="themes/CustomTheme.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile.structure-1.4.2.min.css" />
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
can you see any problems why it won't apply?