CodeIgniter Forums
new and with some questions :-D - 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: new and with some questions :-D (/showthread.php?tid=13077)



new and with some questions :-D - El Forum - 11-10-2008

[eluser]al404[/eluser]
hi!

is my 1st framework... and i'm new to CMV so i have some questions that i can't answear:

- in my site i need to have the web dir (is the one handled by index file) and a CMS dir accessible only by .htaccess autentication. How should i handle this? making in my model folder 2 subdir one web and one CMS? where should i put the .htaccess .htpassword and .htgroup file?

- if i need to upload via PHP some file which would it be the best thir to set them to? in the root a new /file/ folder?

- if i need to store some global variable such as the website title ($data['title'] = "$websittitle Welcome"Wink , where should i write them?

- if i want to add some personal libriries where and how should i add them?

Thanks


new and with some questions :-D - El Forum - 11-10-2008

[eluser]bastones[/eluser]
Quote:- if i need to upload via PHP some file which would it be the best thir to set them to? in the root a new /file/ folder?

Yes, have a separate folder in the root directory is best. Make sure you CHMOD/change the permissions of that folder to 777 so that PHP can upload to that folder. To change permissions in an FTP client you usually right-click and select 'CHMOD' or 'permissions' and set the value to 777 or select every checkbox.

Quote:- if i need to store some global variable such as the website title ($data[‘title’] = ”$websittitle Welcome”Wink , where should i write them?

If you need to load a specific library/helper in every function you simply put it in the constructor. Here is an example:

Code:
<?php
class Forum extends Controller();
function Forum() {
// this is the constructor
parent::Controller();
$this->load->helper('url');
}
}
?>

...for example. You always call the parent controller with parent::Controller() as we're making a function that references to the class/this controller we're in. For more info see this bit of the User Guide.

Quote:- if i want to add some personal libriries where and how should i add them?

I don't need to explain this as all is explained very well here.

Cheers Smile.


new and with some questions :-D - El Forum - 11-11-2008

[eluser]al404[/eluser]
with this

- if i need to store some global variable such as the website title ($data[‘title’] = ”$websittitle Welcome”Wink , where should i write them?

i intended to ask where should i save some variables ad site titles, that you may want to reuses in different templates?
maybe is not possible


new and with some questions :-D - El Forum - 11-11-2008

[eluser]narkaT[/eluser]
[quote author="al404" date="1226440274"]- if i need to store some global variable such as the website title ($data[‘title’] = ”$websittitle Welcome”Wink , where should i write them?[/quote]

I would create a file APP/config/application_config.php and add it to theautoload-array in APP/config/autoload.php

application_config.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
* MISC
*/
$config['foo'] = 'bar';

?>
just watch out not to overwrite any values in the config.php due to duplcate names Wink

autoload.php
Code:
$autoload['config'] = array('application_config');

and accessing you values:
Code:
$foo = config_item('foo');
// OR
$foo = $this->config->item('foo');



new and with some questions :-D - El Forum - 11-11-2008

[eluser]bastones[/eluser]
[quote author="al404" date="1226440274"]with this

- if i need to store some global variable such as the website title ($data[‘title’] = ”$websittitle Welcome”Wink , where should i write them?

i intended to ask where should i save some variables ad site titles, that you may want to reuses in different templates?
maybe is not possible[/quote]

You should check out the user guide at http://www.ellislab.com/codeigniter/user-guide as a lot of your questions are answered there Smile.