Welcome Guest, Not a member yet? Register   Sign In
Having some trouble...
#1

[eluser]Shujin[/eluser]
So i'm having some real trouble with this bit of code...
I've set it up so the main template loads the views of both header, footer and content.
Code:
<?php
    $this->load->view('includes/header', $page, $title);
    
    $this->load->view('pages/'.$page);
    
    $this->load->view('includes/footer');
?>

Now my problem is, I need my footer to display an RSS feed. I have the necessary code to display the RSS feed but how do I get it so that the template is constructed with the RSS feed by default. Without me having to add the RSS feed code to every function of my main controller.

Much thanks,
Geoff
#2

[eluser]nevsie[/eluser]
IS this you displaying your own RSS feed?
Or are you displaying content from another third party RSS feed? I assume this one?

I am not sure on the most efficient method for your instance, but you could use private functions and call them in each location your need, or even use the constructor. Others might advise better, but look at:
http://ellislab.com/codeigniter/user-gui...html#hello
and scroll down a bit to private functions / constructor.
#3

[eluser]InsiteFX[/eluser]
From the userguide:

$this->load->vars($array);

This function takes an associative array as input and generates variables using the PHP extract function. This function produces the same result as using the second parameter of the $this->load->view() function above.

The reason you might want to use this function independently is if you would like to set some global variables in the constructor of your controller and have them become available in any view file loaded from any function.

You can have multiple calls to this function. The data get cached and merged into one array for conversion to variables.

Enjoy
InsiteFX
#4

[eluser]Shujin[/eluser]
Can't quite get this to work...
I'm trying to use the SimplePie RSS but my Controller Index can't find the Class even thought the Library is in the folder.
#5

[eluser]InsiteFX[/eluser]
CodeIgniter SimplePie Library

InsiteFX
#6

[eluser]Shujin[/eluser]
I tried following the guide and got this error: http://uploadir.com/u/2715d288




Theme © iAndrew 2016 - Forum software by © MyBB