Results 1 to 9 of 9

Thread: Config files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2012
    Posts
    81

    Question Config files

    So, I need config.php file
    like $settings['home'] = 'http://mysite.com';

    and include it in index.php so I can use it on the links like that <a href="'.$_settings['home'].'">Home</a>

    how I do the including? thanks!

    didn't find any help from google
    Last edited by vmen; Nov 15th, 2012 at 04:07 PM.

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Config files

    when in doubt, go to the source... http://www.php.net ....
    include_once() function

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2012
    Posts
    81

    Re: Config files

    how to use the $settings['home'] on a link?

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Config files

    just like you would any other variable... that's all it is .... an array called $settings ... and in it is an element named 'home' .... so you can echo it, concatenate it, what ever you need to just like anything else... there's nothing magical or special about it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2012
    Posts
    81

    Re: Config files

    Ok, now how to make a page where I can edit these settings?

  6. #6
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Config files

    If you wish to make the settings editable via Admin panel or something, then for the config.php file, include only the db credentials. Like, dbname, dbuser, dbpassword, dbhost, etc. And keep the rest of the settings inside a table in the database. This would make the editing and fetching pretty easier.

    And when each page loads, first issue a SELECT query to the db to fetch the others settings that would be used in your project.


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Config files

    I jsut open the page in notepad, edit, save, upload...

    but I also work locally when developing a site, then upload it when its ready...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Config files

    Quote Originally Posted by techgnome View Post
    I jsut open the page in notepad, edit, save, upload...

    but I also work locally when developing a site, then upload it when its ready...

    -tg
    Yeah. That's what me too do. But if you wish to allow the user to edit the settings via an Admin Panel made for the project, wouldn't it be better to keep the other settings in the db ? Easy retrieval and updation. Wouldn't it be ? Rather than re-writing the config.php file programmatically!


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  9. #9
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Config files

    If that's the case, sure... but I'm not sure that is the case... the op has been pretty vague... it's probably at this point where I'd turn to the OP and say "Just what is it you're trying to do?"

    @OP - Just what is it you're trying to do here? What's the goal? What's the big picture?


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width