Jump to content

cmaier

Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cmaier's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok... to simplify what i'm trying to get accomplished i just wrote a small example (using if else this time) Original Source: [code] <HTML> <?php $var1 = "THIS IS TEXT"; ?> <BODY> <?php   $code_block = <<<KEYWORD     <H1>TEST H1</H1>     if (!$var1) { <H2>TEST H2</H2> }     else { <H2>$var1</H2> } KEYWORD; echo $code_block; ?> </BODY> </HTML> [/code] View-Source of Output [code] <HTML> <BODY>     <H1>TEST H1</H1>     if (!THIS IS TEXT) { <H2>TEST H2</H2> }     else { <H2>THIS IS TEXT</H2> }</BODY> </HTML> [/code] If you just show me how to make the if/else function as php code i'll be able to figure it out for my foreach example... i just can't find a way to make this work.
  2. I don't see how the contence of the array is related to my question.. but here it is... [code] $global_site_left_column_menu_2_content_array = array( array('Link One', 'http://mydomain.com/subfolder/', 'default_menu'), ); [/code] My problem is that foreach(){} is not being interpreted as php code... my only question is how do i make the loop be parsed as php.
  3. I do... heres the code near the foreach... [code] <TR> <TD> <UL class='menu_inner_list'> foreach ($global_site_left_column_menu_2_content_array as $global_site_left_column_menu_2_item) { <LI> <A class="$global_site_left_column_menu_2_item[2]" href="$global_site_left_column_menu_2_item[1]">$global_site_left_column_menu_2_item[0]</A> </LI> } </UL> </TD> </TR> [/code] ... but it just outputs it as if it were text.. when you view the page you see... foreach (Array as ) { }
  4. Ok... so i have a very large block of code (the majority of my page) enclosed in a string that i print later on... [code] <?php $temp_code_block = <<<TEMP_CODE_KEYWORD .... some html & php code .... foreach loop goes here .... more html & php TEMP_CODE_KEYWORD; echo $temp_code_block; ?> [/code] Everything works fine except i can't figure out how to use loops within that string (a foreach loop specifically)... Since i'm already in a <?php tag and it wouldn't make sense to open another, how would i make "foreach" be recognized as a php reserved word and execute it as a loop? Thanks - cmaier
  5. [!--quoteo(post=353848:date=Mar 11 2006, 12:05 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 11 2006, 12:05 AM) [snapback]353848[/snapback][/div][div class=\'quotemain\'][!--quotec--] You should also note that such a thing would be a big security risk if you did not have some sort of user authentication system in place to keep just anyone from being able to edit your pages and make whatever changes they want or even capture sensitive information. [/quote] Yeah, i have a admin section that i have locked down so only i can access it
  6. Yes, true, but i don't know where to look on there.. under php there are sub-catagories... and no clue which it would be under... possibly a direct link to one?
  7. Hi, i was looking for either a script that already exists... or possibly some ideas on how this would work.. but i want a scrip that will ask for a path to a file (from the root directory of my site).. then i want it to grab the source of that file and display it in a textbox where i can edit it and have the edited source saved over the original file. If this happens i will be perfectly happy, but if a "Make backup copy" check box could be added to save a copy of the original files source to something like [original_file_name].bk.php. Thanks for any help - cmaier
  8. I got this script.... [code]  <?php      session_save_path("/home/content/*/*/*/*****/html/sessions/");      session_start();      define("MAX_IDLE_TIME", 3);      function getOnlineUsers(){      if ( $directory_handle = opendir( session_save_path() ) )       {         $count = 0;         while ( false !== ( $file = readdir( $directory_handle ) ) )          {            if($file != '.' && $file != '..')             {               if(time()- fileatime(session_save_path() . '\\' . $file) < MAX_IDLE_TIME * 60)                {                  $count++;                }             }            closedir($directory_handle);            return $count;          }          else          {            return false;          }       }      echo 'Number of online users: ' . getOnlineUsers() . '<br>';     ?>[/code] .. from [a href=\"http://www.devarticles.com/c/a/PHP/The-Quickest-Way-To-Count-Users-Online-With-PHP/1/\" target=\"_blank\"]here[/a] and it says it does what i want but i can't get it to run correctly... i keep getting an error on the "else"... i can't figure out why.. i've read through it a bunch and everything that is opened seems to be closed correctly and the else appears to be in the correct location. The error i get looks like this... [code]Parse error: parse error, unexpected T_ELSE in /home/content/*/*/*/*****/html/test/index.php on line 149[/code] ... where line 149 contains the "else" phrase. Any ideas? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.