CodeIgniter Forums
Simple Question: Title on page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Simple Question: Title on page (/showthread.php?tid=21919)



Simple Question: Title on page - El Forum - 08-24-2009

[eluser]dunken[/eluser]
Hi.

Just worked with CI for a few days (not counting my vacation =] ).

Right now i am putting:

Code:
$data['title'] = 'My Title';
$data['keywords'] = 'My Keywords';

in all my controllers.

I would like to put it somewhere so I dont have to write it in every constructor.

By mistake I removed my Css-link and I noticed that the page works fine anyway. Does CI find my css-file automatic? It's in root/css/style.css

Thx from Sweden (where it's almost time to sleep)


Simple Question: Title on page - El Forum - 08-24-2009

[eluser]jedd[/eluser]
[quote author="dunken" date="1251170493"]
I would like to put it somewhere so I dont have to write it in every constructor.[/quote]

You can check out my approach at [url="http://codeigniter.com/wiki/Header_and_Footer_and_Menu_on_every_page_-_jedd/"]http://codeigniter.com/wiki/Header_and_Footer_and_Menu_on_every_page_-_jedd/[/url]

Quote:By mistake I removed my Css-link and I noticed that the page works fine anyway. Does CI find my css-file automatic? It's in root/css/style.css

No .. no it doesn't.


Simple Question: Title on page - El Forum - 08-25-2009

[eluser]renownedmedia[/eluser]
Personally, I use a library called "Document" and I'll always run
Code:
$data = $this->Document->generate_data();
or something along those lines..

generate_data() returns an array of default values, some loaded from a database some a config file, etc.

Once I have that data array, if I want to change something specific to a page, I can easily overwrite it like this:

Code:
$data['title'] = 'something else';