Why the header and footer comes after body when rendered? (Processwire) - processwire

Why the header and footer comes after body when rendered? (Planets Tutorial). The planets who are using the planet.php template are children of a page Planets which is based on basic-page.php template. The About page children pages works fine though.
site/templates/planet.php
<html>
<head>
<title><?php echo $page->title; ?></title>
</head>
<body>
<h1><?php echo $page->title; ?></h1>
<h2>
Type: <?php echo $page->planet_type; ?>,
Age: <?php echo $page->planet_age; ?> years
</h2>
<p><?php echo $page->planet_summary; ?></p>
</body>
</html>

Doing a manual intermediate install solved it.

Related

Enable Demographics and Interests reports in Universal Analytics - Magento missing code

I am trying too Enable Demographics and Interests reports in Universal Analytics in my Magento site.
I have read through the already existing question on this and it does not answer my problem: Enable Demographics and Interests reports in Universal Analytics
I already have Universal Analytics set for my Magento site, which was done by simply entering my Google Analytics Account Number in the Magento Backend. It has been working fine for the last few months but I now want to Enable Demographics and Interests reports.
Google Analytics tells me "Your Demographics and Interest Reports have been enabled, but your Analytics tracking code does not include the necessary support to show them", and directs me to the following information page: https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad
It tells me to simply add the following code into the existing tracking code:
ga('require', 'displayfeatures');
I found out that this code should be located at:
app/design/frontend/default/YOURTHEME/template/page/html/head.phtml
However when I open this file, the only code in it is as follows:
<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle() ?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<?php if(Mage::getStoreConfig('milanoconfig/generaloptions/responsive') == 1): ?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<?php endif; ?>
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
<?php echo $this->getIncludes() ?>
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->
From what I have read, this file should also include the following Google Analytics code, but it doesn't:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX-XX', 'example.com');
ga('send', 'pageview');
</script>
Does anyone know why this code isn't currently in this file even though my Google Analytics appears to be working fine, after simply adding the Google Analytics Account Number in the Magento Backend?
Does anyone also know what I should now do to Enable the Demographics and Interests reports. Should I simply add this code manually, or is there a reason why this code isn't already in place, maybe Magento is set up differently these days? I use Magento version 1.7.0.2.
Thanks

My Nestedsortable is not working, because of cannot call the javascript file

Iam using CI version 2.1.2
iam following course by tutplus training
this problem is a when i call the javascript file that's not working properly
iam very counfused day to day iam thingking how make it solved, buat iam cannot
here the script of my page_head file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $meta_title; ?></title>
<!-- Bootstrap -->
<link href="<?php echo site_url('css/bootstrap.min.css'); ?>" rel="stylesheet">
<link href="<?php echo site_url('css/admin.css'); ?>" rel="stylesheet">
<link href="<?php echo site_url('css/datepicker.css'); ?>" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="<?php echo site_url('js/bootstrap.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo site_url('js/bootstrap-datepicker.js'); ?>"></script>
<?php if(isset($sortable) && $sortable === TRUE): ?>
<script src="<?php echo site_url('js/jquery-ui-1.9.1.custom.min.js'); ?>"></script>
<script src="<?php echo site_url('js/jquery.mjs.nestedSortable.js'); ?>"></script>
<?php endif; ?>
Please Somebody help me, please make it file .js working
Use base_url instead of site_url.
For example, replace this...
<script src="<?php echo site_url('js/bootstrap.min.js'); ?>"></script>
...with this...
<script src="<?php echo base_url('js/bootstrap.min.js'); ?>"></script>
Do this for all link and script tag declarations in your head.
From the Codeigniter documentation:
site_url(): Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your site index_page in your config file) will be added to the URL, as will any URI segments you pass to the function, and the url_suffix as set in your config file.
base_url(): Returns your site base URL, as specified in your config file. (...) This function returns the same thing as site_url, without the index_page or url_suffix being appended.

Only first page is saved to pdf from html using dompdf with codeigniter

I am trying to create a pdf from html using dompdf with codeigniter. I have two html pages. My problem is that only the first page is saved in the pdf file. The second one is gone.
Here is my code :
$this->load->library('pdf');
$html = $this->load->view('reports_html/couver1','',true);
$html .= $this->load->view('reports_html/reportContentImageLeft','',true);
$this->pdf->load_html($html);
$this->pdf->render();
other code
$this->data['view'] = $this->load->view('reports_html/reportContentImageLeft','',true);
$html = $this->load->view('reports_html/couver1',$this->data,true);
// $this->pdf->load_html($html);
$this->pdf->load_view('reports_html/couver1',$this->data,true);
$this->pdf->render();
i did like you said but only prints on the pdf file the first page
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>on.plans - reports - cover page 1</title>
<link href="<?php echo base_url()."css/reports.css"?>" rel="stylesheet" type="text/css">
</head>
<body>
<div id="page">
<div id="section" class="cover">
<div class="logo">
<img src="/path/to/officeLogo.jpg" width="300px" height="150px">
</div>
<h1>Meeting date</h1>
<h3>Project name</h3>
</div>
</div>
</body>
</html>
<?php echo $view; ?>
i added the view but its not working
thanks for your answer
You can try something like this:
$data['view'] = $this->load->view('reports_html/reportContentImageLeft','',true);
$html = $this->load->view('reports_html/couver1',$data,true);
$this->pdf->load_html($html);
$this->pdf->render();
$dompdf->stream("test.pdf");
And in your reports_html/couver1 view need do something like this <?=$view;?>
This solution is not the best - but it is work.

How do I remove the slash that appeared right after the body tag?

My website was working fine, when all of a sudden a slash appeared right after the body tag. I tried to find out what was wrong but I had no luck.
How to fix this?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Toucan | <?=$title?></title>
<?php $this->load->view('include/head'); ?>
</head>
<body>
<div id="container">
<?php $this->load->view('include/header'); ?>
<?= $slideshow ?>
<table id="main">
<tr>
<?php if ($sidebar):?>
<td width="150px"><div id="sidebar"><?= $sidebar ?></div></td>
<?php endif; ?>
<td><div id="content"><?= $content ?></div></td>
</tr>
</table>
<?php $this->load->view('include/footer'); ?>
</div>
</body>
</html>
You should take a look at the end of your controller to check if you have a PHP closing tag : ?>. And maybe something like / after it...
This is good practice to omit the PHP closing tag at the end of your scripts.
I just google your webpage (toucan-eng.com) and a slash is showing in the main webpage. The title tag should be inside the head tag and then you need to put the body tag. Hope this can help you

On PageLoad show Magento Static block in ajax

I am running on Magento 1.7 and its a fresh copy.
What I want to achieve:
On pageload of the website, display the newsletter template block
{{block type="newsletter/subscribe" template="newsletter/subscribe.phtml"}}
as a pop-up window in Magento once, where the cookies will expire after a given period of time eg: 1 week.
The answers on web are either not specific, or not detailed enough as my knowledge is not broad on scripts.
What I tried so far:
attempt to add a lightbox:
1) Add Lightbox CSS & JS
<script type="text/javascript" src="<?php echo $this->getJsUrl('lightbox/lightbox.js'); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->getJsUrl('lightbox/lightbox.css'); ?>" media="screen"/>
2) In view.phtml I added a link
Size chart
The lightbox is working but the static block is not called... still figuring out how to call a static box..
I have successfully called a popup consisting static block using the steps below.
http://jsfiddle.net/5USUu/
So basically we need to:
Add .js and .css files - I'm using colorbox
Define the function
Call the function
1) Add the following script in header
<link rel="stylesheet" type="text/css" href="<?php echo $this->getJSUrl('pop/colorbox.css'); ?>" media="screen"/>
<link rel="stylesheet" type="text/css" href="<?php echo $this->getJSUrl('pop/popup.css'); ?>" />
<script language="javascript" src="<?php echo $this->getJSUrl('pop/colorbox.js'); ?>"></script>
<script>
jQuery(document).ready(function (){
if (document.cookie.indexOf('visited=true') == -1){
var fifteenDays = 1000*60*60*24*15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
jQuery.colorbox({width:"580px", inline:true, href:"#subscribe_popup"});
}
jQuery(".open_popup").colorbox({width:"580px", inline:true, href:"#subscribe_popup"});
});
</script>
2) Add this link in html that link to your pop up
Click here to open the popup
3) Add the html that contains your static block identifier
<div style='display:none'>
<div id='subscribe_popup' style='padding:10px;'>
<!-- BEGIN #subs-container -->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('subscribe')->toHtml() ?>
<div id="subs-container" class="clearfix"> </div>
</div>
</div>
<!-- END subscribe popup-->

Resources