Issues with html css on codeigniter template - php
thanks for rading my question, i have an issue with codeigniter, i use an php page as base template for my whole site.
In that template i have a div on the top of the page with differents flags to choose the idiom.
For some reason it only works in one page, and not on the others.
Here is my template
<?php
if (!function_exists("cortar_string")) {
function cortar_string($cadena)
{
return substr( $cadena, 0, 50 );
}
}
if (!function_exists("muestra_mes")) {
function muestra_mes($mes)
{
$r = "";
switch($mes)
{
case 1:
$r = "Enero<br/>January";
break;
case 2:
$r = "Febrero<br/>February";
break;
case 3:
$r = "Marzo<br/>March";
break;
case 4:
$r = "Abril<br/>April";
break;
case 5:
$r = "Mayo<br/>May";
break;
case 6:
$r = "Junio<br/>June";
break;
case 7:
$r = "Julio<br/>July";
break;
case 8:
$r = "Agosto<br/>August";
break;
case 9:
$r = "Septiembre<br/>September";
break;
case 10:
$r = "Octubre<br/>October";
break;
case 11:
$r = "Noviembre<br/>November";
break;
case 12:
$r = "Diciembre<br/>December";
break;
}
return $r;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="robots" content="index, follow" />
<meta name="keywords" content="soporte tecnico, laptop, pc, caracas, grupo soporte tecnico gl, soporte tecnico caracas, informatica, telecomunicaciones, gts, tecnología, ti, it, servicios, igs, campus tecnologicos, continuidad de negocios, comunicaciones integradas, arquitectura y estrategia de ti, mantenimiento y soporte tecnico, middleware, seguridad, privacidad, servidores, data center, outsourcing, almacenamiento de datos, Diseño de Paginas web, aplicaciones web, Venezuela, Maracaibo, Zulia, COL, Cabimas, Ojeda, San Francisco, tecnología, computación, laptops, equipos, computadoras, servicio, sistemas, tecnico, biometrico" />
<meta property="og:title" content="<?php echo $titulo; ?>"/>
<meta property="og:type" content="info" />
<meta property="og:description" content="Sitio de Servicios y Soluciones en Computación, desarrollo de sistemas de información, sitios web, y aplicaciones web. Asesorias en Informática, Soporte técnico Preventivo y Correctivo.">
<meta name="description" content="Sitio de Servicios y Soluciones en Computación, desarrollo de sistemas de información, sitios web, y aplicaciones web. Asesorias en Informática, Soporte técnico Preventivo y Correctivo." />
<meta property="og:image" content="http://i47.photobucket.com/albums/f195/warbandit69/TarjetaRicardo1-1.jpg"/>
<title><?php echo $titulo; ?></title>
<meta charset="utf-8">
<link rel="stylesheet" href="<?php echo base_url(); ?>/css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="<?php echo base_url(); ?>/css/style.css" type="text/css" media="all">
<script type="text/javascript" src="<?php echo base_url(); ?>/js/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/cufon-yui.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/Humanst521_BT_400.font.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/Humanst521_Lt_BT_400.font.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/roundabout.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/roundabout_shapes.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/gallery_init.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/cufon-replace.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>/js/loopedslider.min.js"></script>
<div id="fb-root"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<!--[if lt IE 7]>
<link rel="stylesheet" href="css/ie/ie6.css" type="text/css" media="all">
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/IE9.js"></script>
<![endif]-->
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="<?php echo base_url(); ?>/js/jquery.mousewheel-3.0.6.pack.js"></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="<?php echo base_url(); ?>/source/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/source/jquery.fancybox.css?v=2.1.5" media="screen" />
<!-- Add Button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
<script type="text/javascript" src="<?php echo base_url(); ?>/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<!-- Add Thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
<script type="text/javascript" src="<?php echo base_url(); ?>/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
<!-- Add Media helper (this is optional) -->
<script type="text/javascript" src="<?php echo base_url(); ?>/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
/*
* Simple image gallery. Uses default settings
*/
$('.fancybox').fancybox();
/*
* Different effects
*/
// Change title type, overlay closing speed
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});
// Disable opening and closing animations, change title type
$(".fancybox-effects-b").fancybox({
openEffect : 'none',
closeEffect : 'none',
helpers : {
title : {
type : 'over'
}
}
});
// Set custom style, close if clicked, change title type and overlay color
$(".fancybox-effects-c").fancybox({
wrapCSS : 'fancybox-custom',
closeClick : true,
openEffect : 'none',
helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});
// Remove padding, set opening and closing animations, close if clicked and disable overlay
$(".fancybox-effects-d").fancybox({
padding: 0,
openEffect : 'elastic',
openSpeed : 150,
closeEffect : 'elastic',
closeSpeed : 150,
closeClick : true,
helpers : {
overlay : null
}
});
/*
* Button helper. Disable animations, hide close button, change title type and content
*/
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
/*
* Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/
$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
thumbs : {
width : 50,
height : 50
}
}
});
/*
* Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
*/
$('.fancybox-media')
.attr('rel', 'media-gallery')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
arrows : false,
helpers : {
media : {},
buttons : {}
}
});
/*
* Open manually
*/
$("#fancybox-manual-a").click(function() {
$.fancybox.open('1_b.jpg');
});
$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});
$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : '1_b.jpg',
title : 'My title'
}, {
href : '2_b.jpg',
title : '2nd title'
}, {
href : '3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
});
</script>
<style type="text/css">
.fancybox-custom .fancybox-skin {
box-shadow: 0 0 50px #222;
}
</style>
</head>
<body>
<!-- header -->
<section id="preheader">
<div class="menu_lateral">
<center>
<?php $a = base_url();
$a1 = explode("//",$a);
//print_r($a1);
$a2 = explode("/",$a1[1]);
$web = $a2[0];
?>
<img src="<?php echo base_url(); ?>/images/flags/Venezuela-32.png" alt="Español Venezuela" />
<img src="<?php echo base_url(); ?>/images/flags/Colombia-32.png" alt="Español Colombia" />
<img src="<?php echo base_url(); ?>/images/flags/Spain-32.png" alt="Español España" />
<img src="<?php echo base_url(); ?>/images/flags/Argentina-32.png" alt="Español Argentina" />
<img src="<?php echo base_url(); ?>/images/flags/Chile-32.png" alt="Español Chile" />
<img src="<?php echo base_url(); ?>/images/flags/Mexico-32.png" alt="Español Mexico" />
<img src="<?php echo base_url(); ?>/images/flags/Panama-32.png" alt="Español Panama" />
<a href="http://translate.google.co.ve/translate?sl=auto&tl=pt&js=n&prev=_t&hl=es-419&ie=UTF-8&u=http%3A%2F%2F<?php echo $web; ?>%2F&act=url" ><img src="<?php echo base_url(); ?>/images/flags/Brazil-32.png" alt="Portugues Brasil" /></a>
<a href="http://translate.google.co.ve/translate?sl=auto&tl=pt&js=n&prev=_t&hl=es-419&ie=UTF-8&u=http%3A%2F%2F<?php echo $web; ?>%2F&act=url" ><img src="<?php echo base_url(); ?>/images/flags/Portugal-32.png" alt="Portugues Portugal" /></a>
<a href="http://translate.google.co.ve/translate?sl=auto&tl=en&js=n&prev=_t&hl=es-419&ie=UTF-8&u=http%3A%2F%2F<?php echo $web; ?>%2F&act=url" ><img src="<?php echo base_url(); ?>/images/flags/United-States-32.png" alt="Ingles Estados Unidos USA" /></a>
<a href="http://translate.google.co.ve/translate?sl=auto&tl=en&js=n&prev=_t&hl=es-419&ie=UTF-8&u=http%3A%2F%2F<?php echo $web; ?>%2F&act=url" ><img src="<?php echo base_url(); ?>/images/flags/United Kingdom_32.png" alt="England" /></a>
</center>
</div>
</section>
<header>
<div class="container">
<h1>Soluciones Ríos</h1>
<nav>
<ul>
<li>
<?php
if ($seleccion=="inicio") {
echo anchor("welcome/index","Bienvenido", array("class" => "current"));
}
else
{
echo anchor("welcome/index","Bienvenido");
}
?>
</li>
<li><?php
if ($seleccion=="sobre") {
echo anchor("welcome/sobre","Sobre Mi", array("class" => "current"));
}
else
{
echo anchor("welcome/sobre","Sobre Mi");
}
?>
</li>
<li>
<?php
if ($seleccion=="servicios") {
echo anchor("welcome/servicios","Servicios", array("class" => "current"));
}
else
{
echo anchor("welcome/servicios","Servicios");
}
?>
</li>
<li>
<?php
if ($seleccion=="productos") {
echo anchor("welcome/productos","Productos", array("class" => "current"));
}
else
{
echo anchor("welcome/productos","Productos");
}
?>
</li>
<li>
<?php
if ($seleccion=="contacto") {
echo anchor("welcome/contacto","Contacto", array("class" => "current"));
}
else
{
echo anchor("welcome/contacto","Contacto");
}
?>
</li>
<li>
<?php
if ($seleccion=="mapa") {
echo anchor("welcome/mapa","Mapa", array("class" => "current"));
}
else
{
echo anchor("welcome/mapa","Mapa");
}
?>
</li>
</ul>
</nav>
</div>
</header>
<!-- #gallery -->
<section id="gallery">
<div class="container">
<?php
if (isset($proyectos)) {
$this->load->view($proyectos);
}
?>
</div>
</section>
<!-- /#gallery -->
<?php $this->load->view($main_content); ?>
<!-- footer -->
<footer>
<div class="container">
<div class="wrapper">
<div class="fleft"><div>Sigueme #ricardojriosr <div class="fb-like" data-href="https://www.facebook.com/pages/Ricardo-R%C3%ADos/285721804823546?ref=hl#" data-width="450" data-layout="button_count" data-show-faces="true" data-send="true"></div></div></div>
<div class="fright"><script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<a rel="nofollow" href="mailto:ricardojriosr#gmail.com" target="_blank">ricardojriosr#gmail.com</a> | +58 414-6518896 <u>Skype</u>: ricardojriosr83
</div>
</div>
</footer>
<script type="text/javascript"> Cufon.now(); </script>
</body>
</html>
Here is my website
P.D.: you can see the CSS form the source code of my webpage, thanks
Related
read file from template/index.php for change css file joomla 4
i have some template for joomla 4 in this template developer use 3 css for change color style in front end 1- light 2- dark 3- dark_light this template dont support RTL i added support RTL code in this template <?php $sboost->loadHead(); $sboost->addCSS('template.css,override.css,modules.css,responsive.css,reset.css,plugins.css,style.css'); $sboost->getStyle(); if ($sboost->isRTL()) $sboost->addCSS('template_rtl.css'); $slides = $this->params->get('slides'); ?> <?php if($this->params->get('get_cursor', '1') == '1') : ?> <link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/cursor.css" rel="stylesheet" type="text/css" /> <?php endif; ?> i try add RTL in this template for myself ( i dont want lose LTR Css too ) in this template if i click on Light in front-end template read light.css if i click on Dark in front-end template read Dark.css this code read from index.php in template/mytemplate/index.php My Question : tech me add code inside index.php if my site RTL and click on light read light_rtl.css this code in index.php about change css file <?php if ($this->params->get('moonsun') =="1" ) { ?> <a class="color-scheme bg-base-color-dark d-inline-block" href="javascript:void(0)"><i class="fa fa-moon"></i></a> <a class="color-scheme bg-base-color d-none" href="javascript:void(0)"><i class="fa fa-sun"></i></a> <?php if ($this->params->get('tempBg') =="light" ) : ?> <script> jQuery(function($) { $('.color-scheme').click(function() { var isDarkCss = $("link[href='<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/dark.css']"); if (isDarkCss.length){ isDarkCss.remove(); }else{ $('head').append('<link type="text/css" rel="stylesheet" media="all" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/dark.css">'); } $('.color-scheme').removeClass('d-none').addClass('d-inline-block'); $(this).removeClass('d-inline-block').addClass('d-none'); }); }); </script> <?php elseif ($this->params->get('tempBg') =="dark" ) : ?> <script> jQuery(function($) { $('.color-scheme').click(function() { var isDarkCss = $("link[href='<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/light.css']"); if (isDarkCss.length){ isDarkCss.remove(); }else{ $('head').append('<link type="text/css" rel="stylesheet" media="all" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/light.css">'); } $('.color-scheme').removeClass('d-none').addClass('d-inline-block'); $(this).removeClass('d-inline-block').addClass('d-none'); }); }); </script> <?php else : ?> <script> jQuery(function($) { $('.color-scheme').click(function() { var isDarkCss = $("link[href='<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/dark.css']"); if (isDarkCss.length){ isDarkCss.remove(); }else{ $('head').append('<link type="text/css" rel="stylesheet" media="all" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/dark.css">'); } $('.color-scheme').removeClass('d-none').addClass('d-inline-block'); $(this).removeClass('d-inline-block').addClass('d-none'); }); }); </script> <?php endif; ?> <?php } ?> </div>
Codeigniter Infinite Scroll error
I try to make infinite scroll pagination in my codeigniter project. I'am using this tutorial http://www.mostlikers.com/2016/05/codeigniter-pagination-infinite-scroll.html to make it. But this is what i get View <!DOCTYPE html> <html> <head> <title>deals</title> <link href="<?php echo base_url();?>css/bootstrap.css" rel="stylesheet" type="text/css" media="all" /> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="<?php echo base_url();?>js/jquery.min.js"></script> <!-- Custom Theme files --> <!--theme-style--> <link href="<?php echo base_url();?>css/style.css" rel="stylesheet" type="text/css" media="all" /> <!--//theme-style--> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="Food shop Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" /> <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script> <!--fonts--> <link href='http://fonts.googleapis.com/css?family=Rokkitt:400,700' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Lobster+Two:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <!--//fonts--> <script type="text/javascript" src="<?php echo base_url();?>js/move-top.js"></script> <script type="text/javascript" src="<?php echo base_url();?>js/easing.js"></script> <script type="text/javascript"> jQuery(document).ready(function($) { $(".scroll").click(function(event){ event.preventDefault(); $('html,body').animate({scrollTop:$(this.hash).offset().top},1000); }); }); </script> <link href="<?php echo base_url();?>css/index.css" rel="stylesheet" type="text/css" media="all" /> <link rel="stylesheet" href="<?php echo base_url();?>css/imgslider.css" type="text/css" media="screen" /> <script src="<?php echo base_url();?>js/slideout.min.js"></script> <script src="<?php echo base_url();?>js/jquery.wmuSlider.js"></script> <script src="<?php echo base_url();?>js/jquery.wmuGallery.js"></script> </head> <body> <nav id="menu"> <h1 style="color:white">Menu</h1> <hr style="color:white;"> <ul> <?php if($tipeUser=="user"){?> <li><h4>Home</h4></li> <li><h4 style="color:white">Welcome <?php echo $nama;?></h4></li> <li><h4>My Voucher</h4></li> <li><h4>Profile</h4></li> <li><h4>Logout</h4></li> <?php } else if($tipeUser=="restoran"){ ?> <li><h4>Home</h4></li> <li><h4 style="color:white">Welcome <?php echo $nama;?></h4></li> <li><h4>Dashboard</h4></li> <li><h4>Voucher Management</h4></li> <!-- <li><h4>Reedem Voucher</h4></li> --> <li><h4>Logout</h4></li> <?php } else if($tipeUser==""){ ?> <li><h4>Home</h4></li> <li><h4>Login / Register</h4></li> <li><h4>Voucher</h4></li> <li><h4>Restaurants</h4></li> <?php if($data_kategori->num_rows()>0) { foreach ($data_kategori->result() as $rows) { ?> <li><h4><a href="<?php echo base_url();?>home_controller/Type/<?php echo $rows->id_jenis_makanan; ?>" style="color:white"><?php echo $rows->nama_jenis_makanan;?> </a></h4></li> <?php } } ?> <?php } ?> </ul> </nav> <main id="panel"> <header> <!--header--> <div class="header-in"> <div class="container"> <!----> <div class="header-bottom"> <div class="col-xs-1"> <button class="toggle-button"></button> </div> <div class="col-xs-11"> <?php echo form_open('home_controller/search_bar');?> <div class="search"> <form> <input type="text" id= "input-keyword" name="input-keyword" placeholder="Search ..." value="<?php echo set_value('input-keyword')?>" > <input type="submit" value=""> </form><?php echo form_close(); ?> </div> </div> <div class="clearfix"> </div> </div> <!----> </div> </div> <!----> <div class="container"> <div class="specials"> <ol> <div id="results"></div></ol> </div> </div></div> <div class="container"> <div class="col-md-12"> <p style="height:10px"></p> <div id="pagination" align="center" class="pagination-wrapper"> <ul class="tsc_pagination pagination" align="center"> <!-- Show pagination links --> <!-- <?php foreach ($links as $link) { echo "<li>". $link."</li>"; } ?></ul> --> <!-- </div> --> </div></div> <!----> </header> </main> <?php if($this->session->flashdata('message')) : echo "<script>alert('". $this->session->flashdata('message')."')</script>"; endif; ?> </body> <script> var slideout = new Slideout({ 'panel': document.getElementById('panel'), 'menu': document.getElementById('menu'), 'padding': 190, 'tolerance': 70 }); // Toggle button document.querySelector('.toggle-button').addEventListener('click', function() { slideout.toggle(); }); var userAgent = navigator.userAgent || navigator.vendor || window.opera; if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) ) { slideout.disableTouch(); } slideout.disableTouch(); // auto close slideout.on('open', function() { $( "#panel" ).click(function() { return false; }); $( "#panel" ).click(function() { slideout.close(); }); }); slideout.on('close', function() { $( "#panel" ).unbind('click'); }); </script> <script> $('.gallery').wmuSlider(); </script> </html> <script src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var total_record = 0; var total_groups = <?php echo $total_data; ?>; $('#results').load("<?php echo base_url() ?>Home_controller/load_more", {'group_no':total_record}, function() {total_record++;}); $(window).scroll(function() { if($(window).scrollTop() + $(window).height() == $(document).height()) { if(total_record <= total_groups) { loading = true; $('.loader_image').show(); $.post('<?php echo site_url() ?>Home_controller/load_more',{'group_no': total_record}, function(data){ if (data != "") { $("#results").append(data); $('.loader_image').hide(); total_record++; } }); } } }); }); </script> Model public function get_allDeal_count() { $sql = "SELECT COUNT(*) as tol_records FROM voucher v join restoran r on v.id_restoran = r.id_restoran"; $result = $this->db->query($sql)->row(); return $result; } public function get_allDeal_content($start,$content_per_page) { $sql = "SELECT * FROM voucher v join restoran r on v.id_restoran=r.id_restoran WHERE LIMIT $start,$content_per_page"; $result = $this->db->query($sql)->result(); return $result; } Controller public function list_voucher() { if($this->session->userdata('logged_in')) { $session_data = $this->session->userdata('logged_in'); $data['nama'] = $session_data['nama']; $data['id'] = $session_data['id_user']; $data['tipeUser'] = $session_data['tipe_user']; } else{ $data['nama'] = ""; $data['id'] = "0"; $data['tipeUser']=""; } $data['notif'] = ''; $config['base_url'] = base_url().'/home_controller/list_voucher/'; $data['data_kategori'] = $this->jenismakanan->Getjenismakanan(); $total_data = $this->voucher->get_allDeal_count(); $content_per_page = 5; $data['total_data'] = ceil($total_data->tol_records/$content_per_page); $this->load->view('listalldeals', $data,FALSE); // $this->load->view('listalldeals', $data); } public function load_more() { $group_no = $this->input->post('group_no'); $content_per_page = 5; $start = ceil($group_no * $content_per_page); $all_content = $this->voucher->get_allDeal_content($start,$content_per_page); if(isset($all_content) && is_array($all_content) && count($all_content)) : foreach ($all_content as $key => $content) : echo '<li>'.$content->id_restoran.'</li>'; echo '<p>'.$content->nama_restoran.'</p>'; endforeach; endif; } That's all the code that I used. I don't know what should I do to fix it.
Google chart is not working on server side
I have a view that shows a chart depending on a date time range and one value from select list, it is currently working perfect in my local, but in my server it just dont chart anything, can anyone help me pls. Here is the view code: <html> <head> <title>Gráfico</title> <link href="<?php echo base_url(); ?>css/bootstrap-combined.min.css" rel="stylesheet"> <link href="<?php echo base_url(); ?>css/bootstrap-glyphicons.css" rel="stylesheet"> <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> <link href='http://fonts.googleapis.com/css?family=Lato:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <link href="<?php echo base_url(); ?>estilos.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url(); ?>css/bootstrap-datetimepicker.min.css"> <meta charset="utf-8" /> <!--Load the AJAX API--> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); //Funcion para generar un gráfico en Lineas function LineChart() { var data = google.visualization.arrayToDataTable(<?= $grafico2;?>); var options = { title: '<?php echo "Paquetes recibidos por la IP: ".$ip." en las fechas: ".$fechainicio." - ".$fechafin; ?>', 'width':900, 'height':400, hAxis: {title: 'Fechas', titleTextStyle: {color: 'black'},}, vAxis: {title: 'Paquetes', titleTextStyle: {color: 'black'},} }; var chart = new google.visualization.LineChart(document.getElementById('linechart_div')); chart.draw(data, options); } google.setOnLoadCallback(LineChart); </script> </head> <body> <div id="contenido"> <div class="container"> <?php include_once "header.php"; ?> <?php echo form_open('home/graph'); ?> <font color="#27A7D6">Seleccione fecha inicial:<br></font> <div id="datetimepicker" class="input-append date"> <input type="text" name="fechainicio"></input> <span class="add-on"> <i data-time-icon="glyphicon glyphicon-time" data-date-icon="glyphicon glyphicon-minus"></i> </span> </div> <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.11.0.js"> </script> <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap.min.js"> </script> <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap-datetimepicker.min.js"> </script> <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap-datetimepicker.es.js"> </script> <script type="text/javascript"> $('#datetimepicker').datetimepicker({ format: 'yyyy/MM/dd hh:mm:ss', language: 'es' }); </script> <font color="#27A7D6">Seleccione fecha final:<br></font> <div id="datetimepicker2" class="input-append date"> <input type="text" name="fechafin"></input> <span class="add-on"> <i data-time-icon="glyphicon glyphicon-time" data-date-icon="glyphicon glyphicon-minus"></i> </span> </div> <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.11.0.js"> </script> <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap.min.js"> </script> <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap-datetimepicker.min.js"> </script> <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap-datetimepicker.es.js"> </script> <script type="text/javascript"> $('#datetimepicker2').datetimepicker({ format: 'yyyy/MM/dd hh:mm:ss', language: 'es' }); </script> <!-- INICIO DEL SELECT IP--> <?php require_once ('funciones.php'); $con=fullconectar(); $res=mysql_query("select * from alarmas",$con); ?> <font color="#27A7D6">Seleccione su IP:<br></font> <select id="ip" name ="ip" style="width:235px"> <?php while($fila=mysql_fetch_array($res)){ ?> <option><?php echo $fila['ip']; ?></option> <?php } ?> </select> <div><input type="submit" value="Enviar" /></div> <?php echo form_close(); ?> <?php echo "Total de tiempo offline para la IP: ".$ip." entre las fechas: ".$fechainicio." - ".$fechafin.": ".$tiempooff." minutos."; ?> <div id="linechart_div"></div> </div></div> </body> </html>
Looking at the actual output, the problematic line is here: var data = google.visualization.arrayToDataTable(<?= $grafico2;?>); You'll notice that the <?= $grafico2;?> didn't get parsed by your PHP engine. This indicates that you don't have short-tags enabled on your server. For the moment, just swich that line to: var data = google.visualization.arrayToDataTable(<?php echo $grafico2;?>); But you'll probably want to enable short-tags for the future.
Jquery color picker not working after ajax call
In my site I have added a jQuery color picker textbox as like: http://www.eyecon.ro/colorpicker/ When loading page through ajax then this color picker is not working. That means color picker is not working after ajax call. How can i solve this problem? My site is a CodeIgniter site: This is my index page source code: <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Rock website</title> <link href="<?php echo base_url();?>style/style_user_admin.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>style/jquery-jvert-tabs-1.1.4.css" /> <script type="text/javascript" src="<?php echo base_url();?>/js/ajaxupload.js"></script> <script type="text/javascript" src="<?php echo base_url();?>js/jquery-1.4.1.min.js"></script> <script type="text/javascript" src="<?php echo base_url();?>js/colorpicker.js"></script> <script type="text/javascript" src="<?php echo base_url();?>js/eye.js"></script> <script type="text/javascript" src="<?php echo base_url();?>js/utils.js"></script> <script type="text/javascript" src="<?php echo base_url();?>js/layout.js?ver=1.0.2"></script> <link rel="stylesheet" href="<?php echo base_url();?>css/colorpicker.css" type="text/css" /> <script type="text/javascript" src="<?php echo base_url();?>js/jquery-jvert-tabs-1.1.4.js"></script> <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>js/jquery.cleditor.css" /> <script type="text/javascript" src="<?php echo base_url();?>js/jquery.cleditor.js"></script> <script type="text/javascript"> $(document).ready(function(){ page_setup(); }); </script> <script type="text/javascript"> function page_setup() { $.ajax({ type: "POST", url: "<?php echo base_url();?>index.php/super_admin/page_setup/", success: function(msg){ //alert(msg); $("#page_setup").html(msg).show(); } }); } </script> </head> <body> <div class="wraper"> <div class="welcome_to_admin"> Super Admin Panel </div> <div class="admin_main"> <div id="vtabs1"> <div> <ul> <li>Page Setup</li> </ul> </div> <div> <div id="page_setup"> <!-- load the page_setup.php page here --> </div> </div> </div> </div> </div> </body> </html> This is the super_admin controller code: public function page_setup() { $this->load->view('super_admin/page_setup'); } This is the page_setup.php page code: <div class="tab1_rgt_part"> <div class="message_to_send_11">Color Settings</div> <div class="tab1_main_part" style="margin-top:20px;"> <div class="tab1_left_part">Welcome Page Bg Color</div> <input type="text" maxlength="6" size="6" id="colorpickerField1" value="00ff00" /> </div>
try adding the color picker after loading the html: function page_setup() { $.ajax({ type: "POST", url: "<?php echo base_url();?>index.php/super_admin/page_setup/", success: function(msg){ //alert(msg); $("#page_setup").html(msg).show(); $("#colorpickerField1").ColorPicker( onChange: function (hsb, hex, rgb) { $(this).val(hex); } ); } }); }
$('#colorpickerField1, #colorpickerField2, #colorpickerField3,#colorpickerField4).ColorPicker({ onSubmit: function(hsb, hex, rgb, el) { $(el).val("#"+hex); //$(el).css("background-color","#"+hex); $(el).ColorPickerHide(); }, onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } }) I found the answer.Add this code in a script tag at the top of the view page
jQuery Loading Content into a Div with CodeIgniter
I am trying to dynamically load content from my database into a div in my view called dynamic. I have a grid of products to the left of the dynamic div and when a user clicks on one of them I want the dynamic div to be populated with details on the product that they clicked on. Additionally, I would like the page to load with the first product selected and displayed automatically. I have tried to follow several tutorials on how to do this, but all I have done is run in circles. Any help is appreciated. My code is below: Controller (category.php): public function product() { $product_id = $_POST['product_id']; $data['product'] = $this->Category_model->getOneProduct($product_id); } Model (Category_model.php): public function getOneProduct($id) { $result = $this->db->query("SELECT * FROM product WHERE product_id = ?", array($id)); return $result->row_array(); } View (category_view.php): <!DOCTYPE html> <html lang="en"> <head> <title><?php echo $page['page_title']; ?></title> <meta charset="utf-8"> <meta name="keywords" content="<?php echo $page['page_meta_keywords']; ?>"/> <meta name="description" content="<?php echo $page['page_meta_description']; ?>"/> <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css" type="text/css" media="all"> <link rel="stylesheet" href="<?php echo base_url(); ?>css/menu.css" type="text/css" media="all"> <link rel="stylesheet" href="<?php echo base_url(); ?>css/bgstretcher.css" type="text/css" media="all"; /> <link href='http://fonts.googleapis.com/css?family=Didact+Gothic:regular' rel='stylesheet' type='text/css' /> [removed][removed] [removed][removed] [removed][removed] [removed] $(document).ready(function(){ $('body').bgStretcher({ images: ['<?php echo base_url(); ?>images/background.jpg'] }); $('#slideshowHolder').jqFancyTransitions({ delay: 5000, width: 483, height: 573, }); }); [removed] </head> <body> <div id="main"> <div>/div> <?php $this->load->view('menu_view'); ?> <div id="content"> <div id="left"> <div id="slideshowHolder"> <?php foreach ($rotators as $rotator) { ?> <img src="<?php echo base_url(); ?>images/<?php echo $rotator['rotator_photo']; ?>" width="100%" alt=""> <?php } ?> </div> </div> <div id="right"> <div> <table width="50%" cellpadding="5" > <tr> <?php $sql_endRow = 0; $sql_columns = 3; $sql_hloopRow1 = 0; foreach ($products as $product) { if($sql_endRow == 0 && $sql_hloopRow1++ != 0) { ?> <tr> <?php } ?> <td align="center"> <a href=""> <img src="<?php echo base_url(); ?>products/<?php echo $product['product_thumbnail']; ?>" /> </a> </td> <?php $sql_endRow++; if($sql_endRow >= $sql_columns) { ?> </tr> <?php $sql_endRow = 0; } } if($sql_endRow != 0) { while ($sql_endRow < $sql_columns) { ?> <td> </td> <?php $sql_endRow++; } ?> </tr> <?php }?> </table> </div> <div id="dynamic"> <?php //print_r($one_product); ?> </div> </div> <div>/div> </div> </div> </body> </html> </code>
In product(), Make the product_id come from GET instead of POST so that your links will work without javascript. $product_id = $_GET['product_id']; In getOneProduct($id): return json_encode($result->row_array()); HTML: <table width="50%" cellpadding="5" id="product-grid"> <!-- snip --> <a href="/your/url/product?product_id=<?php echo $product['product_id']; ?>" data-product-id="<?php echo $product['product_id']; ?>"> <img src="<?php echo base_url(); ?>products/<?php echo $product['product_thumbnail']; ?>" /> </a> example javascript (jquery): $('#product-grid a').click(function(e){ e.preventDefault(); $.ajax({ type: "GET", url: "/your/url/product", data: "product_id=" + $(this).attr('data-product-id'), success: function(msg){ var product_data = jQuery.parseJSON(msg); // do something with product_data $('#dynamic').html('New product: ' + product_data.product_id); } }); });