How to set siteside constants - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to set siteside constants (/showthread.php?tid=2197) |
How to set siteside constants - El Forum - 07-21-2007 [eluser]omed habib[/eluser] Hi, Where exactly can I define constants that can be used through the entire site (i.e. model, view and controller)? I have constants I want to define that are server specific (for my various development environments and the live site) that I want to define to be used throughout the site. Thanks! Omed How to set siteside constants - El Forum - 07-21-2007 [eluser]woopsicle[/eluser] config.php works for me. How to set siteside constants - El Forum - 07-21-2007 [eluser]omed habib[/eluser] I tried that... I can't figure out how exactly to set the constant. For example, doing this: define("MAXSIZE", 100); The constant 'MAXSIZE' isnt accessible. Any ideas? How to set siteside constants - El Forum - 07-21-2007 [eluser]woopsicle[/eluser] mmm strange. an example of how i use this is below: config.php Code: ... my_controller.php Code: ... This works perfectly for me.. but if you are having problems I have no idea could be a server problems.. but it is strange. How to set siteside constants - El Forum - 07-21-2007 [eluser]esra[/eluser] I use a lot of constants in helper and plugin files and sometimes at the head of some controller files. I modified index.php to require a separate defines file just after APPPATH is defined in index.php. Code: /* Then you can add whatever constants you need quickly. In the above, I store the defines.php under includes/. How to set siteside constants - El Forum - 07-22-2007 [eluser]omed habib[/eluser] This was awesome... thanks guys... your posts were of definite help! Coming from an (officially) former user of Symfomy, PHP Fusebox and CakePHP user, I have to say, I LOVE this framework! How to set siteside constants - El Forum - 09-03-2007 [eluser]maomaode[/eluser] Is it possible to define a constants just for some models, say, in case of a blog system, i want to some constants just for the post model, so i have a post_constants.php, if it's a comment model, i have a comment_constants.php... How to set siteside constants - El Forum - 03-02-2009 [eluser]Unknown[/eluser] Fantastic Esra! This was just what I was looking for. Clean, functional, and easy to understand for the next developer. Thanks! How to set siteside constants - El Forum - 03-02-2009 [eluser]Milos Dakic[/eluser] Couldn't the constants.php file in the application/config folder be used for this or am I missing the point? How to set siteside constants - El Forum - 03-02-2009 [eluser]TheFuzzy0ne[/eluser] [quote author="Milos Dakic" date="1236056663"]Couldn't the constants.php file in the application/config folder be used for this or am I missing the point?[/quote] Sure, but that's just too easy! |