Menu

define('blah', 'blah');

Help
Anonymous
2001-11-20
2001-11-20
  • Anonymous

    Anonymous - 2001-11-20

    For some reason..the 'define' doesn't seem to work. .. let me show you an example:

    // <?
    /////////////////////////   
    //     maxl_lib.php    //
    //     November 17th   //
    /////////////////////////

        define(DBHOST,                'localhost');
        define(DBUSERNAME,             '*********');
        define(DBPASSWORD,             '*******');
        define(DEFAULT_DB_NAME,         'gaffle_net');
        define(SERVER_ADMIN,            'maxl@gaffle.net');
        define(SITE_NAME,            'gaffle.net');
        define(MAIN_PAGE_ARTICLE_LIMIT,         '15');
            define(DEFAULT_FONT,            'Verdana');

       
        include('template.inc');

        function db_connect() {

            if (mysql_connect('localhost','root',''))  {
       
                mysql_select_db('blah');
            }

            else {
                 $error = sprintf("Error Connecting to DEFAULT_DB_NAME", mysql_errno());
                   $mail_to = SERVER_ADMIN;
                   $mail_from_name = SITE_NAME;
                    $mail_from_address = SERVER_ADMIN;
                    $mail_subject = 'Error with Database';
                     $mail_body = $error;
                     maxl_mail($mail_to, $mail_from_name, $mail_from_address, $mail_subject, $mail_body);
                 die($error);
                }
           }
           
           function maxl_mail($to, $from_name, $from_address, $subject, $body)  {
             
                       $from = print("From: $from_name<$from_address>");
                     mail($to, $subject, $body, $from);
           }
     
         
          
    ?>        

    Ok....so it supposedly defines the variables there.
    If you try to connect to the database, substituing 'DBHOST' for 'localhost'...it won't work. it says that it can't connect to 'DBHOST'..

    Then, if you try and parse it within a template..it just won't show up.

    so i have something like
    <i>define('DEFAULT_FONT', 'Verdana');</i>

    And when i parse the template..it will grab everything from the database and such, but it won't insert 'Verdana' into the {DEFAULT_FONT} area.

    Anyone have any idea on why this isn't working?
    Thanks.

    Alex

     
    • Anonymous

      Anonymous - 2001-11-20

      I take that back....it turns out you can use the DBHOST and such INSIDE of maxl_lib.php

      they just never seemed to get parse when they are placed in a template as {DBHOST}..

       
    • Anonymous

      Anonymous - 2001-11-20

      bah, i lied again. it doesn't work. :\

       

Log in to post a comment.