Jump to content

Recommended Posts

Hello all, I am making promo page, but it's giving me this error 

"Fatal error: Using $this when not in object context in /home/fhlbg/public_html/application/views/promo_test.php on line 2"

 

file is promo_test.php


<?php $this->view("common/header"); ?>

 <link rel="canonical" href="<? echo site_url() ?>" />
<!-- <link rel="stylesheet" href="/css/bx_styles/bx_styles.css" type="text/css" /> -->
<!-- <script type="text/javascript" src="/js/jquery.bxSlider.js"></script> -->
<!-- <script type="text/javascript" src="/js/jquery.bxslider.min.js"></script> -->

<div class="inner">
        <div class="inner shadow">
            <?php 
                $query = 'SELECT id, 
                                 title_bg AS `title_cat` 
                                 FROM  categories
                                 WHERE is_active = 1';
                $result = $this->db->query($query);
            ?>
            

            <?php foreach ($result->result() as $row): ?>
               

I can't understant how $this is working here, because in the already done page "home.php" is working, both are in the same directory. 

This is home.php:

<?php $this->view("common/header"); ?>
<link rel="canonical" href="<? echo site_url() ?>" />
<!-- <link rel="stylesheet" href="/css/bx_styles/bx_styles.css" type="text/css" /> -->
<!-- <script type="text/javascript" src="/js/jquery.bxSlider.js"></script> -->
<!-- <script type="text/javascript" src="/js/jquery.bxslider.min.js"></script> -->
<script type="text/javascript">
	jQuery(document).ready(function($) {
        $('#slider1').bxSlider({
            slideSelector: 'div.slide',
            controls: false,
            pager: false,
            pause: 3000,
            auto: true,
            autoHover: true,
            moveSlides: 3,
            minSlides: 1,
            maxSlides: 3,
            slideWidth: 235
        });
		
    });
</script>
<div class="inner inner-transparent">
    <div class="slider-wrapper theme-default">
        <div id="slider" class="nivoSlider">
            <?PHP

If anyone can help me solve this or to explane me how it works here.

Edited by nudl3s
Link to comment
https://forums.phpfreaks.com/topic/302913-using-this-when-not-in-object/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.