Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6703741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:12:25+00:00 2026-05-26T07:12:25+00:00

For some reason I’m getting an undefined variable on the view and not quite

  • 0

For some reason I’m getting an undefined variable on the view and not quite sure why. When I do a print_r of the variable of footer_links it shows up fine as such:

Array ( [0] => stdClass Object ( [link_name] => Home [short_name] => index ) 1 => stdClass Object ( [link_name] => About Us [short_name] => about-us ) [2] => stdClass Object ( [link_name] => Site Map [short_name] => site-map ) [3] => stdClass Object ( [link_name] => Contact-Us [short_name] => contact-us ) [4] => stdClass Object ( [link_name] => News Feed [short_name] => news-feed ) )

I know I’m not passing the variable in but when I tried it with the build it didn’t work. Not sure why I should be passing it in. I’m using Phil Sturgeon’s template library.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: footer_links

Filename: v1/footer.php

Line Number: 4
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: v1/footer.php

Line Number: 4

Controller:

$activeTemplate = $this->kow->getTemplate(); 
$siteInfo = $this->kow->getSiteTitleAndSlogan(); 
$footer_links = $this->kow->getFooterNav(); 
$this->template
     ->title($siteInfo[0]->site_name,$siteInfo[0]->site_slogan)
     ->prepend_metadata('<link rel="stylesheet" type="text/css" href="http://www.kansasoutlawwrestling.com/assets/css/'.$activeTemplate[0]->short_name.'.css" />')
     ->set_partial('header', $activeTemplate[0]->short_name.'/header')
     ->set_partial('footer', $activeTemplate[0]->short_name.'/footer')
     ->build('kow');  

View:

<div id="footer">

    <ul>
       <?php foreach($footer_links as $row)
        {
        ?>
        <li><a><?php echo $row->link_name; ?></a></li>
        <?php
        }
        ?>  
    </ul>

    <p>&copy;COPYRIGHT 2010 ALL RIGHTS RESERVED</p>

</div>

EDIT:

I found this stackoverflow question which is the same sort of deal I’m working with.
Creating Dynamic Links Through DB and CI

Controller:

$activeTemplate = $this->kow->getTemplate(); 
$siteInfo = $this->kow->getSiteTitleAndSlogan(); 
$footer_links['rows'] = $this->kow->getFooterNav(); 
$this->template
->title($siteInfo[0]->site_name,$siteInfo[0]->site_slogan)
->prepend_metadata('<link rel="stylesheet" type="text/css" href="http://www.kansasoutlawwrestling.com/assets/css/'.$activeTemplate[0]->short_name.'.css" />')
->set('footer', $footer_links)            
->set_partial('header', $activeTemplate[0]->short_name.'/header')
->set_partial('footer', $activeTemplate[0]->short_name.'/footer')
->build('kow');

Model:

function getFooterNav()
{
    $this->db->select('site_menu_structures_links.link_name,site_menu_structures_links.short_name');
    $this->db->from('site_menu_structures_links');
    $this->db->join('site_menu_structures', 'site_menu_structures.id = site_menu_structures_links.menu_structure_id');
    $this->db->where('site_menu_structures.short_name', 'footernav'); 
    $query = $this->db->get();
    return $query->result_array();
}

View:

<div id="footer">

    <ul>
       <?php foreach($rows as $row)
        {
        ?>
        <li><a><?php echo $row->link_name; ?></a></li>
        <?php
        }
        ?>  
    </ul>

    <p>&copy;COPYRIGHT 2010 ALL RIGHTS RESERVED</p>

</div>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:12:25+00:00Added an answer on May 26, 2026 at 7:12 am

    I’m not familiar with the template engine you’re using but how are you passing your variable to your view? Are you doing the print_r inside the controller (of course here it will show) or view? Try putting var_dump($footer_links); exit; as the first line in your footer.php file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting undefined for some reason when I try to return the html via
hi im trying to using flashVars however for some reason there not getting sent
For some reason I'm not getting this. (Example model below) If I write: var
I'm writing a program in C++ and for some reason I'm getting a segmentation
I have just tried using the NSArchiver but for some reason I am getting
For some reason I am having trouble getting my head around __init__ and __new__
I have a problem with getting my pager-function to work. For some reason it
For some reason I never see this done. Is there a reason why not?
I am getting an error that options is undefined. The dropdown shows up but
For some reason I'm getting a Trace/BPT trap error when calling urllib.urlopen . I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.