LemonStand Forum: Overwrite Settings through config.php or module - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Overwrite Settings through config.php or module

#1 User is offline   activeholdingco 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 177
  • Joined: 23-September 10

Posted 23 January 2011 - 06:29 PM

I am currently developing LS on a local copy as well as a server copy to test the different environments. They all feed off the same database. Ive run into a snag with the file based templates.

Since the path to the directory is stored in the database it will not work locally and on the server with the same database.

Is there an easy way to overwrite settings through a module? What about making it so that config.php can store the path of the templates?

I think the best option would allow us through a module to extend or change any of the site settings. Im looking to change this: Cms_SettingsManager::get()->templates_dir_path.

Thanks for any help you might have.
0

#2 User is online   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 24 January 2011 - 04:38 PM

Hi!

I'm sorry, but LemonStand is not intended for working in the shared database mode. The scenario you described is not typical, and most likely we will not make any changes in the core to allow it, at least in near future. LemonStand users usually develop websites in a development environment and then import CMS object to the live copy, and do the same operation for updating the live copy.

Thank you

#3 User is offline   activeholdingco 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 177
  • Joined: 23-September 10

Posted 25 January 2011 - 07:03 AM

Heres the delima. I have 2 employees working on my application aswell as myself. The site is under version control and all using the same database to test our code from. LS is currently not multi-developer friendly if we cannot use a central database. Actually it already is with the exception of the newly added feature file based templates and storing the path in the DB.

Although not typical, should I not be able to use a central database with two servers during development? Ive purchased a license and when deployed this site will work on one server.

At any rate, all I am asking for is a way for modules to overwrite some settings that store paths? Or the config.php to allow this?

Why do you not wish to allow this?
0

#4 User is offline   activeholdingco 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 177
  • Joined: 23-September 10

Posted 25 January 2011 - 07:34 AM

Heres another example. What if we wish to store our templates out of a web accessible directory. Why not do something like this:

config.php
$CONFIG['TEMPLATE_PATH'] = '/home/someuser/secure/templates';


cms_page.php
$settings_manager = Cms_SettingsManager::get();
$path = $settings_manager->templates_dir_path.'/pages';
$file_path = Phpr::$config->get('TEMPLATE_PATH', '');
if(!empty($file_path))
$path = $file_path;


Would this not be beneficial? The only problem I have is when you store paths in the database and not in a configuration file. In my opinion file based templates should use the resources directory unless you specify somewhere else in the config.php.

Why allow the user to manually input the directory? What happens if they change the directory does everything get copied over?

This post has been edited by activeholdingco: 25 January 2011 - 07:36 AM

0

#5 User is offline   Eric 

  • Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,290
  • Joined: 04-August 10
  • LocationVancouver, Canada

Posted 25 January 2011 - 09:07 AM

Hi Patrick, if I'm not mistaken, do relative directories not work? resources/cms for the path.
0

#6 User is offline   activeholdingco 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 177
  • Joined: 23-September 10

Posted 25 January 2011 - 09:36 AM

Thanks Eric,

This solved my problem. Never even thought to try relative directories because it says right above it the full path install of LS so I thought it needed the full path.

I would still like to vote for LS defaulting to resources/cms for the path and allowing developers to change this in config.php and not through the admin panel. I think this is more a developer oriented feature anyway and allowing the user to easily change this could become a problem down the road especially when moving servers (if the path is not relative).

Thanks though, I really appreciate it!
0

#7 User is offline   Fred Carlsen 

  • Member
  • Group: Members
  • Posts: 1
  • Joined: 15-April 11

Posted 15 April 2011 - 02:52 AM

I would argue that important settings like this should be possible to override in a config file, especially when they might be enviroment specific. This increases the flexibility much more, and also allow you to version control these settings in a good way.
0

#8 User is offline   Eric 

  • Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,290
  • Joined: 04-August 10
  • LocationVancouver, Canada

Posted 15 April 2011 - 05:34 PM

View PostFred Carlsen, on 15 April 2011 - 02:52 AM, said:

I would argue that important settings like this should be possible to override in a config file, especially when they might be enviroment specific. This increases the flexibility much more, and also allow you to version control these settings in a good way.


Thanks for the suggestion guys. We've added to our list. We'll let you know if/when it's published.
0

#9 User is offline   ecjonathan 

  • Member
  • Group: Members
  • Posts: 10
  • Joined: 16-June 11

Posted 20 July 2011 - 06:58 AM

View PostEric, on 15 April 2011 - 05:34 PM, said:

Thanks for the suggestion guys. We've added to our list. We'll let you know if/when it's published.


I know the original post for this thread was quite a while ago and you guys said you've added it to your list, but has this been looked at yet? I have searched and couldn't find anything in the docs.

The "Path to the templates directory" setting asks for an absolute path, I have tried using a relative path as a work-around and have come into random template rendering problems as a result.

I agree with the other posts, all environment-specific configuration options should be set (or overridden) in a file, especially paths, as is the case with other CMS/e-commerce software I use. I currently work on a copy of a website locally (with version tracking) but connect to the live database therefore it is not possible to use absolute paths if the setting is stored in the database. Having to maintain two separate copies of the database every time I need to work on the website will make it signicantly more difficult and time consuming.
0

#10 User is online   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 05 September 2011 - 04:04 PM

Hi guys,

We just published an update which adds the {APP} specifier support to the templates path. It allows you to create templates paths relative to LemonStand installation directory. Updated documentation article: http://lemonstandapp...ased_templates/

Thank you

#11 User is offline   ecjonathan 

  • Member
  • Group: Members
  • Posts: 10
  • Joined: 16-June 11

Posted 06 September 2011 - 12:25 AM

Excellent, with the new {APP} specifier and the TEMPLATE_PATH configuration parameter, this problem is now completely solved for me, thanks for working on a solution. :D
0

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users