Need some help

Hi, I'm quite experienced in PHP but this is the first time I have really considered using a framework like this.

I have a few questions about making a website more dynamic.

Okay, first question.

I know of course how I would go about making this sort of thing from scratch, but I just don't know the proper way of doing it with this framework. How would I go about making a dynamic title that can be called throughout the whole system like this in my templates:

Second question.
How do I go about loading classes in each one of my scripts without having to include them each time?

Thanks for any help.

Hi, glad to see someone else that new to using the framework besides me Big Grin, First off my suggestion is if you are not used to MVC Models you should do some reading up on the theory behind them, Which will help answer both your questions I think.

you short tag example is for a template engine which CI dose not have built in there are several libraries available that you can include into your projects quickly to help with this, and a few really good examples on the forums here for that matter just do a search and im sure you will find a great starting point.

the way I am doing titles is im loading seperate veiws one that has the style.css title etc in it then it loads the working data set example

in my controller
$this->data['title']='Bann User';
     $this->data['query'] = $this->bu->get_entries($this->uri->segment(3));
         $this->load->view('template', $this->data);

<!DOCTYPE html>
&lt;html lang="en"&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
    &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
    &lt;link rel="stylesheet" href="&lt;?php echo base_url();?&gt;css/style.css" type="text/css" media="screen" /&gt;
    <div id="wrapper">      

        <div id="header">

        <div id="main_content">
            &lt;?php //$this->load->view('menu'); ?&gt;
            &lt;?php $this->load->view($page); ?&gt;


        <div id="footer">
            Copyright 2010. &lt;!-- or create a view and load here --&gt;

in the example im sending $this->data['page']='edit_banned_user_form'; to the template which it calls that as an additional view to be loaded and integrates it into the template.php like an include essentially

I actually found this method on the forums here Big Grin dont remember the author though

there are other ways, so id just look around and find what suits your needs and style.

Your first question is used in the [url=""]parser class[/url]. This will allow you to interpret curly braces as pseudo variables.

You may [url=""]autoload[/url] any library, helper, model, config in /application/config/autoload.php. The great part of CI is the user guide. It will be very helpful.

Oh thanks for that info Big Grin im sure that will come in handy later one. On a side not just looked through the links in your sig and wow those are very useful indeed.

Thanks, they are something you could almost use in every project. I found myself posting links enough for this stuff, I though I might as well pimp some other people's code. You will find a lot of useful snippets on Phil's blog...great member of CI.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.