Remove sidebar on some pages on Wordpress - php

I am trying to edit a Worpress template. Everything work as as expected except that I wish to have a page without sidebar - which is not included in that template.
To achieve this I went to the template's folder, duplicated the "page.php" and named it page-nosidebar.php. Over there I deleted the get_sidebar call script. Here is how it looks like now:
<?php /*
Template Name: No Sidebars
*/ ?>
<?php get_header(); ?>
<div id="single_cont">
<div class="single_left">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1 class="single_title"><?php the_title(); ?></h1>
<div class="single_inside_content">
<?php the_content(); ?>
</div><!--//single_inside_content-->
<br /><br />
<?php //comments_template(); ?>
<?php endwhile; else: ?>
<h3>Sorry, no posts matched your criteria.</h3>
<?php endif; ?>
</div><!--//single_left-->
<div class="clear"></div>
</div><!--//single_cont-->
<?php get_footer(); ?>
After this, I went to the page editor and assigned this new template to the page I wanted to have no sidebar. Problem? Sidebar still shows up.
How should I do? Thanks in advance!
UPDATE
footer.php
<div class="clear"></div>
<div id="footer">
<div class="footer_text"> <?php echo date("Y"); ?> Company. Powered by Company</div>
</div><!--//footer-->
</div><!--//main_container-->
<?php wp_footer(); ?>
</body>
</html>
header.php
<!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" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Raleway:400,100,200' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Cabin:700' rel='stylesheet' type='text/css'> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <?php wp_head(); ?> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <!--[if lt IE 9]> <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> <![endif]--> <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>--> <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery-latest.js"></script> <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/scripts.js"></script> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.infinitescroll.js" type="text/javascript" charset="utf-8"></script> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" title="no title" charset="utf-8"/> <script type="text/javascript"> $(document).ready( function($){ $('#content_inside').infinitescroll({
navSelector : "div.load_more_text",
// selector for the paged navigation (it will be hidden)
nextSelector : "div.load_more_text a:first",
// selector for the NEXT link (to page 2)
itemSelector : "#content_inside .home_post_box"
// selector for all items you'll retrieve },function(arrayOfNewElems){
$('.home_post_box').hover( function() { $(this).find('.home_post_text').css('display','block'); }, function () { $(this).find('.home_post_text').css('display','none'); } );
//$('.home_post_cont img').hover_caption();
// optional callback when new content is successfully loaded in.
// keyword `this` will refer to the new DOM content that was just added.
// as of 1.5, `this` matches the element you called the plugin on (e.g. #content)
// all the new elements that were found are passed in as an array
}); } ); </script> </head> <body> <?php $shortname = "neue"; ?> <?php if(get_option($shortname.'_background_image_url','') != "") { ?> <style type="text/css"> body { background-image: url('<?php echo get_option($shortname.'_background_image_url',''); ?>'); } </style> <?php } ?> <div id="main_container"> <div id="header"> <div class="left"> <?php if(get_option($shortname.'_custom_logo_url','') != "") { ?>
<img src="<?php echo stripslashes(stripslashes(get_option($shortname.'_custom_logo_url',''))); ?>" class="logo" /> <?php } else { ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.jpg" class="logo" /> <?php } ?> </div>
<div class="right"> <div class="head_social">
<?php if(get_option($shortname.'_twitter_link','') != "") { ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/twitter-icon.png" />
<?php } ?>
<?php if(get_option($shortname.'_facebook_link','') != "") { ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/facebook-icon.png" />
<?php } ?>
<?php if(get_option($shortname.'_google_plus_link','') != "") { ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/google-plus-icon.png" />
<?php } ?>
<?php if(get_option($shortname.'_dribbble_link','') != "") { ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/dribbble-icon.png" />
<?php } ?>
<?php if(get_option($shortname.'_pinterest_link','') != "") { ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/pinterest-icon.png" />
<?php } ?>
<div class="clear"></div> </div><!--//head_social-->
<div class="header_menu"> <!--
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>CATEGORIES
<ul>
<li>Wordpress Themes</li>
<li>Create Plugins</li>
<li>Wordpress Themes</li>
<li>Create Plugins</li>
</ul>
</li>
<li>BLOG</li>
<li>CONTACT</li>
</ul>-->
<?php wp_nav_menu('menu=header_menu&container=false&menu_id='); ?>
<div class="clear"></div> </div><!--//header_menu-->
<div class="clear"></div> </div> <div class="clear"></div> <div class="tagline"> <?php echo get_option($shortname.'_header_text','Use Neue Theme Settings to update this text...') ?> </div><!--//tagline-->
</div><!--//header-->

Related

how to use css link in php code?

hi i'm doing my web programming h/w and got a problem
this is code :
<!DOCTYPE html>
<html>
<head>
<title>Music Viewer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://www.cs.washington.edu/education/courses/cse190m/09sp/labs/3-music/viewer.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="header">
<h1>190M Music Playlist Viewer</h1>
<h2>Search Through Your Playlists and Music</h2>
</div>
<ul>
<?php
$songs = glob("songs/*.mp3");
foreach ($songs as $songfile) {
$text = file_get_contents($songfile);
file_put_contents($songfile, strrev($text));
basename($songfile)
?>
<li><a href <?= "$songfile" ?>> <?= basename($songfile) ?></a> </li>
<?php
}
?>
<?php
$txt = glob("songs/*.txt");
foreach ($txt as $textfile) {
$textt = file_get_contents($textfile);
file_put_contents($textfile, strrev($textt));
basename($textfile)
?>
<li><a href <?= "$textfile" ?>> <?= basename($textfile) ?></a> </li>
<?php
}
?>
</ul>
</body>
</html>
this is about showing the song lists in the folder using glob
and i wanna apply same css style from html code which is
<link href="http://www.cs.washington.edu/education/courses/cse190m/09sp/labs/3-music/viewer.css" type="text/css" rel="stylesheet" />
how to do this ???

Issue with CSS divs in Joomla 3 Template index.php file

We're having an issue with a Joomla site using Artisteer exported code (no choice), and we can't get our index.php working properly.
If you view the website at www.arctrades.com , you can see our issue. The content is in a div sitting at the bottom of the page, and won't float on the right hand side of the page where the content should go!
Any help would be greatly appreciated.
Thanks!
<?php
defined('_JEXEC') or die;
/**
* Template for Joomla! CMS, created with Artisteer.
* See readme.txt for more details on how to use the template.
*/
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'functions.php';
// Create alias for $this object reference:
$document = $this;
// Shortcut for template base url:
$templateUrl = $document->baseurl . '/templates/' . $document->template;
Artx::load("Artx_Page");
// Initialize $view:
$view = $this->artx = new ArtxPage($this);
// Decorate component with Artisteer style:
$view->componentWrapper();
JHtml::_('behavior.framework', true);
?>
<!DOCTYPE html>
<html dir="ltr" lang="<?php echo $document->language; ?>">
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $document->baseurl; ?>/templates/system/css/system.css" />
<link rel="stylesheet" href="<?php echo $document->baseurl; ?>/templates/system/css/general.css" />
<!-- Created by Artisteer v4.2.0.60623 -->
<!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->;
<link rel="stylesheet" href="<?php echo $templateUrl; ?>/css/template.css" media="screen" />
<!--[if lte IE 7]><link rel="stylesheet" href="<?php echo $templateUrl; ?>/css/template.ie7.css" media="screen" /><![endif]-->
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Titillium+Web&subset=latin"; />
<script>if ('undefined' != typeof jQuery) document._artxJQueryBackup = jQuery;</script>
<script src="<?php echo $templateUrl; ?>/jquery.js"></script>
<script>jQuery.noConflict();</script>
<script src="<?php echo $templateUrl; ?>/script.js"></script>
<script src="<?php echo $templateUrl; ?>/modules.js"></script>
<?php $view->includeInlineScripts() ?>
<script>if (document._artxJQueryBackup) jQuery = document._artxJQueryBackup;</script>
<link href='http://fonts.googleapis.com/css?family=Titillium+Web:400,700,900,300' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="art-main">
<div class="art-sheet clearfix">
<?php echo $view->position('banner1', 'art-nostyle'); ?>
<?php echo $view->positions(array('top1' => 15, 'top2' => 65, 'top3' => 20), 'art-nostyle'); ?>
<div class="art-content-layout">
<div class="art-layout-wrapper">
<div class="art-content-layout-row">
<?php if ($view->containsModules('left')) : ?>
<div class="art-layout-cell art-sidebar1">
<?php echo $view->position('left', 'art-block'); ?>
</div></div>
<?php endif; ?>
<div class="art-layout-cell art-content">
<?php
echo $view->position('banner2', 'art-nostyle');
if ($view->containsModules('breadcrumb'))
echo artxPost($view->position('breadcrumb'));
echo $view->positions(array('user1' => 50, 'user2' => 50), 'art-article');
echo $view->position('banner3', 'art-nostyle');
echo artxPost(array('content' => '<jdoc:include type="message" />', 'classes' => ' art-messages'));
echo '<jdoc:include type="component" />';
echo $view->position('banner4', 'art-nostyle');
echo $view->positions(array('user4' => 50, 'user5' => 50), 'art-article');
echo $view->position('banner5', 'art-nostyle');
?>
</div>
<?php if ($view->containsModules('right')) : ?>
<div class="art-layout-cell art-sidebar2">
<?php echo $view->position('right', 'art-block'); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php echo $view->positions(array('bottom1' => 33, 'bottom2' => 33, 'bottom3' => 34), 'art-block'); ?>
<?php echo $view->position('banner6', 'art-nostyle'); ?>
</div>
<footer class="art-footer">
<div class="art-footer-inner">
<?php if ($view->containsModules('copyright')) : ?>
<?php echo $view->position('copyright', 'art-nostyle'); ?>
<?php else: ?>
<p>Link1 | Link2 | Link3</p>
<p>Copyright © 2013. All Rights Reserved.</p>
<?php endif; ?>
</div>
</footer>
</div>
<?php echo $view->position('debug'); ?>
</body>
</html>​

Error in header.php broke my WP site?

I somehow managed to blow my Wordpress Site up; The last file I was in was my header.php, I've been combing through it for a couple hours and haven't found whats causing the break yet.
Any suggestions:
Header.php below:
<?php
/**
* #package WordPress
* #subpackage Default_Theme
*/
?>
<!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" <?php language_attributes(); ?> >
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>"/>
<meta property="fb:admins" content="1641586359" />
<title>
<?php
if($pagePtr =="home"){
print"Read It Forward";
}else if( is_search() ){
echo the_search_query(); print" - Read It Forward Search Results";
}else{
wp_title('', true, 'left');
} ?>
<?php //bloginfo('name'); ?>
</title>
<meta name="description" content="Sneak peeks at great reads, behind-the-scenes insights from authors, lively & provocative reader's guides & fabulous free books." />
<link type="text/css" href="<?php bloginfo('template_directory'); ?>/style.css" rel="stylesheet" />
<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/images/rif_icon.gif" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if (is_single()) { ?>
<meta property="og:title" content="<?php single_post_title(''); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php
if($image= get_post_meta($post->ID, "image", true)) { echo $image; }
else if($isbn= get_post_meta($post->ID, "isbn", true)) { ?>http://www.randomhouse.com/images/dyn/cover/?source=<?php echo $isbn; ?>&height=225&maxwidth=150<?php }
else { ?>
http://www.crownpublishing.com/images/readitforward/rif_square.jpg
<?php }?>" />
<?php } ?>
<link href="<?php bloginfo('template_directory'); ?>/tweet/tweet.css" media="all" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.crownpublishing.com/js/jquery.hoverIntent.minified.js"></script>
<script language="javascript" src="<?php bloginfo('template_directory'); ?>/tweet/jquery.tweet.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="http://www.randomhouse.com/js/emv.js"></script>
<script language="javascript" src="<?php bloginfo('template_directory'); ?>/includes/RIFvalid.js" type="text/javascript"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script>
<!--[if IE]>
<style>
.searchfield {
position:relative;
top:-1px;
}
</style>
<![endif]-->
</head>
<body>
<div id="BGcontainer">
<div id="container">
<div align="center" style="width:100%; background:#FFF;"><img src="<?php bloginfo('template_directory'); ?>/images/readitforward_ad.jpg" style="max-width:700px; border: 15px solid white"/></div>
<div id="header">
<div id="title">
<img src="http://www.osmproduction.com/RIF/wp-content/uploads/2012/02/NewRIF_logo.gif" border="0" alt="Read It Forward"><br />
<p>Sneak peeks at great reads, behind-the-scenes insights from authors, lively and provocative reader's guides, and fabulous free books</p>
<div class="clear"></div>
</div>
<div id="Hsocial">
<div id="Hscontainer">
<div class="clear"></div>
<a class="SCRIBDbutton buttonHover" href="http://www.scribd.com/document_collections/2697109"></a>
<a class="GRbutton buttonHover" href="http://www.goodreads.com/user/show/3313709"></a>
<a class="FBbutton buttonHover" href="http://www.facebook.com/ReadItForward"></a>
<a class="TWbutton buttonHover" href="http://twitter.com/readitforward"></a>
<a class="YTbutton buttonHover" href="http://www.youtube.com/user/crownbooks#g/c/CBA6E62882B7B93F"></a>
<a class="RSSbutton buttonHover" href="<?php bloginfo('rss2_url'); ?>"></a>
<div class="clear"></div>
<?php
if( function_exists('FA_display_slider') ){
FA_display_slider(64);
}
?>
</div>
</div>
<div id="searchBox">
<?php get_search_form(); ?>
</div>
<?php //MENU: http://spyrestudios.com/how-to-create-a-sexy-vertical-sliding-panel-using-jquery-and-css3/ ?>
<?php //SLIDEIN tab: http://spyrestudios.com/how-to-create-a-sexy-vertical-sliding-panel-using-jquery-and-css3/ ?>
</div>
</div>
<div align="center">
<ul id="nav" align="center">
<li class="navItem"><p class="navInfo">FREE BOOKS</p></li>
<li class="navItem"><p class="navInfo">READER REVIEWS</p></li>
<li class="navItem"><p class="navInfo">MEET THE AUTHOR</p></li>
<li class="navItem"><p class="navInfo">MEET THE EDITOR</p></li>
<li class="navItem"><p class="navInfo">BOOK GROUPS</p></li>
<li class="navItem"><p class="navInfo">FAVORITES</p></li>
<li class="navItemLast navMenu">
<p class="navInfo">ALL CATEGORIES</p>
<div align="left">
<ul class="subNavMenu">
<li><div class="subNavItem">Book Groups</div></li>
<li><div class="subNavItem">Critics Rave</div></li>
<li><div class="subNavItem">Enthusiasms</div></li>
<li><div class="subNavItem">Free Books</div></li>
<li><div class="subNavItem">Gift Guide</div></li> <li><div class="subNavItem">Living with Books</div></li>
<li><div class="subNavItem">Meet the Author</div></li>
<li><div class="subNavItem">Meet the Editor</div></li>
<li><div class="subNavItem">Reader Reviews</div></li>
<?php //wp_list_categories('orderby=name&include=3343'); ?>
</ul>
</div>
</li>
<?php /*
<li class="navItemLast navMenu"><p class="navInfo">RECENT ISSUES</p>
<ul class="subNavMenu">
<li>Test 1</li>
<li>Test 2</li>
<li>Test 3</li>
</ul>
</li>
*/?>
<?php //MENU: http://spyrestudios.com/how-to-create-a-sexy-vertical-sliding-panel-using-jquery-and-css3/ ?>
<?php //SLIDEIN tab: http://spyrestudios.com/how-to-create-a-sexy-vertical-sliding-panel-using-jquery-and-css3/ ?>
</ul>
</div>
</div>
<script>
$('.navItem').click(function() {
var newLink = $('a:first-child',this).attr("href");
if(newLink != "" && newLink != "#") {
window.location =newLink;
}
return false;
});
</script>
<script>
$('.navItem').click(function() {
var newLink = $('a:first-child',this).attr("href");
if(newLink != "" && newLink != "#") {
window.location =newLink;
}
return false;
});
</script>
UPDATE: Is there an app anywhere online to run tests for errors? I think it may be a missing closing tag somewhere, though I haven't spotted it. I've ran syntax tests against PHP 4+ on a site I found, and appears I'm OK there.
Try turning debugging on.
http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Log
This should give you an idea of where to start. Otherwise comment out all the php code on the page. Then uncomment them line by line until you find out what causes your page to break. This is where your syntax error will be.
Also, it is a bit unclear what blow up is. It doesn't work at all? Or it works, but the page isn't displaying properly? The former case will be a php error, the latter likely a closing tag issue.

Partial View | Not Loading CSS

I am having an issue with my addSale function, I can get it to load the content but it does not carry the CSS from my Main Template CSS link through to my jQuery Colorbox pop up box,
How could I make my partial view load the required CSS document?
Main Template:
<!DOCTYPE html>
<!--[if lt IE 7 ]><html lang=en-us class="no-js ie6"><![endif]-->
<!--[if IE 7 ]><html lang=en-us class="no-js ie7"><![endif]-->
<!--[if IE 8 ]><html lang=en-us class="no-js ie8"><![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang=en-us class=no-js> <!--<![endif]-->
<head>
<title><?php echo str_replace(".php","",ucfirst(basename($_SERVER['REQUEST_URI']))); ?> : Nationwide Housemovers</title>
<link href="<?php echo base_url()?>includes/css/adminstyle.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?php echo base_url()?>includes/css/colorbox.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" href="<?=base_url()?>includes/css/validationEngine.jquery.css" type="text/css" media="screen">
<script type="text/javascript" src="<?php echo base_url() ?>includes/js/ckedit/ckeditor.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>includes/js/shiv.js"></script>
</head>
<body>
<div id ="wrapper">
<div id="header">
<div class="companyName"></div>
<div class="companyQuote"></div>
</div>
<div id ="leftCol">
<nav>
<ul>
<?php if($this->session->userdata('logged_in')): ?>
<li><?php echo anchor('admin/dashboard', 'Dashboard');?></li>
<li><a>Edit Pages</a>
<?php if(is_array($cms_pages)): ?>
<ul>
<?php foreach($cms_pages as $page): ?>
<li><?=$page->name?></li>
<?php endforeach; ?>
</ul> <!-- UL Close -->
<?php endif; ?>
</li> <!-- Edit Close -->
<li>Gallery
<ul>
<li><?php echo anchor('admin/addimage','Add Image');?></li>
<li><?php echo anchor('admin/deleteimage','Delete Image');?></li>
<li><?php echo anchor('admin/imagecaption','Edit Caption');?></li>
</ul>
</li> <!-- Gallery Close -->
<li>Sales
<ul>
<li><?php echo anchor('admin/addsale','Add Sale');?></li>
<li><a>Edit Sale</a>
<?php if(is_array($sales_pages)): ?>
<ul>
<?php foreach($sales_pages as $sale): ?>
<li><?=$sale->name?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li><!-- LI Edit Sale Close -->
<li><?php echo anchor('admin/deletesale','Delete Sale');?></li>
</ul><!-- UL Close -->
<li><?php echo anchor('admin/home/logout','Log Out');?></li>
<?php else: ?>
<?php redirect('admin/home'); ?>
<?php endif; ?>
</ul>
</nav>
</div><!--leftCol End -->
<section id="content">
<h1><?=$title?></h1>
<?=$content?>
</section>
<div class="clear"></div>
<footer>
<p>LTD <?php echo date('Y'); ?></p>
</footer>
</div>
<script type="text/javascript" src="<?php echo base_url() ?>includes/js/jquery-1.5.1.min.js"></script>
<script src="<?= base_url() ?>includes/jquery.colorbox-min.js" type="text/javascript"></script>
<script src="<?= base_url() ?>includes/js/jquery.colorbox.js" type="text/javascript"></script>
<script src="<?= base_url() ?>includes/js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="<?= base_url() ?>includes/js/jquery.validationEngine.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a[rel='newSale']").colorbox({width:"80%", height:"80%", iframe:true});
$("a[rel='editsale']").colorbox({width:"50%", inline:true, href:"#addSale"});
$("#pageEdit").validationEngine();
$("#addImage").validationEngine();
$("#addSale").validationEngine();
$("#editSale").validationEngine();
$('#captionSelect').change(function(){
var id = $(this).val();
var caption = $('#captionOption_' + id).html();
var thumbname = $('#captionOption_' + id).attr('title');
$('#captionInput').val(caption);
$('#preview').attr('src', '/includes/uploads/gallery/thumbs/' + thumbname);
alert('/path/to/pictures/' + thumbname + '.jpg');
});
});
</script>
</body>
</html>
Sales View:
<div id="newSale">
Add Sale
</div>
<?php if($sales_pages): ?>
<?php foreach($sales_pages as $sale): ?>
<div id ="salesItem">
<img class="thumbnail" src="<?=base_url()?>includes/uploads/sales/thumbs/<?=$sale->thumbname?>" alt="<?=$sale->name?>"/>
<div class="items">Delete | Images</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
Sales Controller:
class Sales extends CI_Controller {
function __construct(){
parent::__construct();
$this->load->library('user_agent');
}
function index() {
if(!$this->session->userdata('logged_in')) {
redirect('admin/home');
}
// Main Page Data
$data['sales_pages'] = $this->sales_model->getSalesPages();
$data['cms_pages'] = $this->navigation_model->getCMSPages();
$data['title'] = 'Sales';
$data['content'] = $this->load->view('admin/sales', $data, TRUE);
$this->load->view('admintemplate', $data);
}
function addSale(){
$this->load->view('admin/testview', TRUE);
}
}
Since you use an iframe, i think you should build a proper html document, complete with its own stylesheet.

Linking site-wide CSS file with CakePHP

I'm very new to PHP, and just customizing my homepage. This is the main layout I have for all of my pages:
<!DOCTYPE html>
<html>
<head>
<title><?php echo $title_for_layout ?></title>
<?php echo $scripts_for_layout ?>
</head>
<body>
<div id="header">
</div>
<div id="content">
<?php echo $content_for_layout ?>
</div>
<div id="footer">
</div>
</body>
</html>
I want to have a global CSS file for all pages on my site called "style.css" which will be stored in app/webroot/css/style.css. I have tried doing this:
<!DOCTYPE html>
<html>
<head>
<title><?php echo $title_for_layout ?></title>
<link href="<?php $html->css('style', 'stylesheet', array('media'=>'all' ), false); ?>" rel="stylesheet" type="text/css" />
<?php echo $scripts_for_layout ?>
</head>
<body>
<div id="header">
</div>
<div id="content">
<?php echo $content_for_layout ?>
</div>
<div id="footer">
</div>
</body>
</html>
But it's not showing up in the output HTML. Any ideas?
Thanks!
you are definitely new to Cake :) here:
<title><?php echo $title_for_layout ?></title>
<?php
echo $this->Html->css('style');
echo $scripts_for_layout;
?>
That will output the full link element for you.

Categories