add head content in codeigniter sub folder - codeigniter

i use sub folder in controller like admin_panel
in admin_panel / main.php i use this code
public function index()
{
$h_data['title'] = 'admin';
$c_data = array();
$this->parser->parse('admin/head',$h_data);
$this->parser->parse('admin/index',$c_data);
}
and head.php in view/admin contain :
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../assets/css/font.css" type="text/css" />
<link rel="stylesheet" href="../assets/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../assets/css/bootstrap-responsive.css" rel="stylesheet">
<link rel="stylesheet" href="../assets/css/bootstrap-theme.min.css" type="text/css" />
<!-- HTML5 shim for IE backwards compatibility -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../assets/css/admin_style.css" />
<script type="text/javascript" src="../assets/js/jquery.min.js"></script>
<script type="text/javascript" src="../assets/js/bootstrap.min.js"></script>
<title> {title} </title>
</head>
asstes folder exist in root project but when refresh page all head tags return 404 and not found ???

You could try
public function index() {
// Load Parser library or autoload it.
$this->load->library('parser');
$data['title'] = "Page Title";
$data['base_url'] = base_url(); // Make sure you add url helper to autoload.
// May need to add true, i.e $this->parser->parse('header', $data, true);
$data['header'] = $this->parser->parse('header', $data);
// May need to add true, i.e $this->parser->parse('footer', NULL, true); Null No Data
$data['footer'] = $this->parser->parse('footer');
$this->parser->parse('content', $data);
}
On Content View Area's
<?php echo $header;?>
Content
<?php echo $footer;?>
Header View Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<title><?php echo $title;?></title>
<base href="<?php echo base_url();?>"></base>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/admin/css/bootstrap.css" media="screen">
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/admin/css/custom.css" media="screen">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/admin/js/common.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/admin/js/filemanager.js"></script>
</head>
<body>
Footer View Example
<footer id="footer">
<br />
</footer>
</div>
<script type="text/javascript" src="<?php echo base_url();?>assets/admin/js/bootstrap.min.js"></script>
</body>
</html>
Auto load url helper
$autoload['helper'] = array(
'url',
'file',
'form',
'text',
'html',
'date'
);

i find answer this error occure for .htaccess not suitable code . i use this htaccess and work fine :)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Related

Undefined variable: header (View: C:\blog\resources\views\pages\welcome.blade.php)

I am getting the below error when running application,
Undefined variable: header (View: C:\blog\resources\views\pages\welcome.blade.php)
My getIndex() function in Controller:
public function getIndex(){
\View::make('pages/welcome')->nest('header', 'layout.header');
return view('pages/welcome');
}
My welcome.blade.php
{{ $header }}
<body>
....
</body>
My _partial/header.blade.php,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Blog Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{{ asset('css/style.css') }}" rel="stylesheet">
</head>
After following the answer, the html looks like,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Blog Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="http://127.0.0.1:8000/css/style.css" rel="stylesheet">
</head>
You're creating a view with a nested subview, then creating & returning a totally new view without the nested subview instead:
public function getIndex(){
\View::make('pages/welcome')->nest('header', 'layout.header');
return view('pages/welcome');
}
Should be
public function getIndex(){
return \View::make('pages/welcome')->nest('header', 'layout.header');
}
Note that view() is an alias of \View::make().
You can prevent the HTML from being escaped by using {!! $header !!} instead.
With Laravel 5+ development, you should be using Components and Slots to inject templates into your views instead.

CSS not responding. Caching issue

<html lang="en">
<head>
<title>Corey Maller</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="style.css" type="text/css" rel="stylesheet">
</head>
I want to make some small changes to my css file but the website is not responding to them. Is there any kind of caching html code I could add to the header?

jqGrid is not a function

I'm trying to use jqgrid 5.1.1 and I got this error: $('#gridMain').jqgrid is not a function.
I don't know what to do solve the problem.
Please help me!!
Here is my code
<%# page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My First Grid</title>
<link rel="stylesheet" type="text/css" media="screen" href="/jqgrid_5.1.0/css/ui.jqgrid.css" />
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="/jqgrid_5.1.0/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="/jqgrid_5.1.0/js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="/jqGrid_5.1.0/js/i18n/grid.locale-kr.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function (){
console.log("aa");
$('#gridMain').jqGrid({});
});
</script>
</head>
<body>
<h2>jqGrid test</h2>
<table id="gridMain"></table>
</body>
</html>
enter image description here
I solved the problem.
The cause was a wrong path.
Thank you for your commnet!!!
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid_5.1.0/css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid_5.1.0/css/custom.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid_5.1.0/css/ui.jqgrid-bootstrap.css" />
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="jqgrid_5.1.0/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="jqgrid_5.1.0/js/i18n/grid.locale-kr.js" type="text/javascript"></script>

How can I correctly import an header and a footer page into a FreeMarker page?

I am working on a Spring MVC application that use FreeMarker for my views.
I am absolutly new in FreeMarker and I have the following problem: in my projct I have 3 files that have to be assemblet togheter into a single page.
So I have:
1) header.ftl representing the header of all my pages, somthing like:
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js is-ie8"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Registrazione - MY WEBSITE</title>
<meta name="robots" content="noindex,nofollow">
<link rel="stylesheet" href="resources/css/webfont.css">
<link rel="stylesheet" href="resources/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="resources/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="resources/plugins/bs-select/bootstrap-select.min.css">
<link rel="stylesheet" href="resources/plugins/bs-dialog/bootstrap-dialog.min.css">
<link rel="stylesheet" href="resources/css/style.css" />
</head>
<body id="main">
<!-- versione per popup. non prendere in considerazione -->
<!--
<div class="container page-header">
<h1>MY WEBSITE</h1>
</div>
2) footer.ftl representing the footer of all my pages:
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugins/bs-select/bootstrap-select.min.js"></script>
<script src="assets/plugins/bs-select/i18n/defaults-it_IT.min.js"></script>
<script src="assets/plugins/bs-dialog/bootstrap-dialog.min.js"></script>
<script src="assets/plugins/jq-form-validation/jquery.validation.js"></script>
<script src="assets/js/functions.lib.js"></script>
<script src="assets/js/form-validation.js"></script>
</body>
</html>
3) Then I have my specific page (named myPage.ftl that represent only the content, something like this:
<h1>This is the content</h1>
<p>Some inforamation</p>
The header.ftl and the footer.ftl are into this directory **\WEB-INF\freemarker\layout** of my project.
So my problem is: how can I import the header.ftl content above the content of the myPage.ftl and the footer.ftl under the content of myPage.ftl page?
I did this using user-defined macros for page layouts, e.g. let's call your layout standardPage.ftl:
<#macro standardPage title="">
<!DOCTYPE html>
<html lang="en">
<head>
<title>${title}</title>
</head>
<body>
<#include "/include/header.ftl">
<#nested/>
<#include "/include/footer.ftl">
</body>
</html>
</#macro>
Then you can call this macro in each of your pages, e.g. homePage.ftl:
<#include "/pages/standardPage.ftl" />
<#standardPage title="Home">
<h1>Home Page</h1>
<p>This bit replaces the nested tag in the layout</p>
</#standardPage>

Joomla <jdoc:include type="head" /> not rendering correctly - renders in <body> tag

Recently I was migrating a web page from joomla 1.5 -> joomla 3.2.
The template itself works great.
The content is not displayed because of the tag.
The written code I have in my index is as:
<?php
defined('_JEXEC') or die('Restricted access'); // no direct access
JHtml::_('behavior.framework',true);
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'functions.php';
$document = null;
if (isset($this))
$document = & $this;
$baseUrl = $this->baseurl;
$templateUrl = $baseUrl . '/templates/' . $this->template;
artxComponentWrapper($document);
?>
<!DOCTYPE html>
<html xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>"
xmlns:jdoc="http://www.w3.org/1999/XSL/Transform">
<head>
<jdoc:include type="head" name="all" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<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" />
<link rel="stylesheet" type="text/css" href="<?php echo $templateUrl; ?>/css/template.css" media="screen" />
<!--[if IE 7]><link rel="stylesheet" href="<?php echo $templateUrl; ?>/css/template.ie7.css" type="text/css" media="screen" /><![endif]-->
<script type="text/javascript" src="<?php echo $templateUrl; ?>/script.js"></script>
</head>
...
</html>
And this renders as:
<html xml:lang="sl-si" lang="sl-si" xmlns:jdoc="http://www.w3.org/1999/XSL/Transform" class="chrome win">
<head>
<style type="text/css"></style>
</head>
<body>
<jdoc:include type="head" name="all">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<link rel="stylesheet" href="/templates/system/css/system.css" type="text/css">
<link rel="stylesheet" href="/templates/system/css/general.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/TKMS/templates/tkms_theme/css/template.css" media="screen">
<!--[if IE 7]><link rel="stylesheet" href="/TKMS/templates/tkms_theme/css/template.ie7.css" type="text/css" media="screen" /><![endif]-->
<script type="text/javascript" src="/TKMS/templates/tkms_theme/script.js"></script>
<!--CONTENT-->..
</jdoc:include>
Why does this happen? How can I fix this? I read that this happens because of BOM, but I could not fix it.
try to move the
<jdoc:include type="head" name="all">
tag into the head-tags, right (You have it in the body). That's at least where it's supposed to be. Not sure if it will actually render, though...
The problem is that the theme is an Artisteer theme. To solve this issue simply open the .artx theme and export for other joomla version.
If you don't have the .artx file then I cannot help you because I deemed the problem unsolvable.

Resources