problem with Includes

Problems with the Windows version of XAMPP, questions, comments, and anything related.

problem with Includes

Postby edevil » 10. February 2006 08:39

Hi, I'm working on a big project but Im stuck with a very wierd problem.

I added a new class in my config.php
Code: Select all
include('libraries/controller.forms.php');


The contents of the file is as follows
Code: Select all
<?php

Class FormController extends controller {

   // Add New Project form
   function AddProjectProceed($pgn){
     $NextPgn = $pgn + 1;
    
     if ($configuration['htaccess'] == true) {
           $NextPg = $path.'control/add/project/'.$NextPgn;
        } else {
           $NextPg = $path.'control.php?action=add&type=project&id='.$NextPgn;
        }
     return $NextPg;
    
   }
   
   function TimeStamp($type) {
     $date = date("j M Y");
    
     $explode = explode(" ", $date);
    
     $DD = $explode[0];
     $MMM = $explode[1];
     $YYYY = $explode[2];
    
     if ($type == 'days'){
     // The Days
      for ($d = 1; $d <= 31; $d++) {
      ($d = $DD) ? ($selected = 'selected="selected" ') : ($selected = '');
      return '<option ' . $selected .'>' . $d . '</option>';
        }
     }
   
    if ($type == 'months'){
    // The Months
      $MMarray = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
      foreach($MMarray as $Month) {
        ($Month = $MMM) ? ($selected = ' selected="selected" ') : ($selected = '');
        return '<option'.$selected.'>' . $Month . '</option>';
      }
     }
   
    if ($type == 'years'){
    // The Years
        return '<option>' . $YYY . '</option>';
        
      $5YY = $YYYY + 5;    
        // Returning a dropdown with 5 years
        for ($i = $YYYY; $i <= $5YY; $i++) {
         return '<option>' . $i . '</option>';
        }
        
    } 
   }
}

?>



The problem is that It returns this error
Code: Select all
$d"); } } if ($type == 'months'){ /* The Months */ $MMarray = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'); foreach($MMarray as $Month) { ($Month = $MMM) ? ($selected = ' selected="selected" ') : ($selected = ''); return '' . $Month . ''; } } if ($type == 'years'){ /* The Years */ return '' . $YYY . ''; /* $5YY = $YYYY + 5; // Returning a dropdown with 5 years for ($i = $YYYY; $i <= $5YY; $i++) { return '' . $i . ''; } */ } } } ?>戼⁲㸯㰊㹢慆慴牥潲㱲戯㨾†慃汬琠湵敤楦敮⁤畦据楴湯›愠摤牰橯捥灴潲散摥⤨椠戼䌾尺睷屷潤浴硡捜湯牴汯瀮灨⼼㹢漠楬敮㰠㹢㜱⼼㹢戼⁲㸯


Some of it is in Chinese (even though my installation is in English)
It seems that the file is parsed as text.

Do you have any solutions?

Thanks in advance.
edevil
 
Posts: 3
Joined: 21. May 2005 08:14

Re: problem with Includes

Postby jsdev » 10. February 2006 18:37

I added a new class in my config.php
[code]include('libraries/controller.forms.php');[/code]

The contents of the file is as follows
[code]<?php

Class FormController extends controller {
...
if ($type == 'months'){
// The Months
$MMarray = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
...
if ($type == 'years'){
// The Years
return '<option>' . $YYY . '</option>';

?>[/code]


The problem is that It returns this error
[code]$d"); } } if ($type == 'months'){ /* The Months */ $MMarray = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'); foreach($MMarray as $Month) { ($Month = $MMM) ? ($selected = ' selected="selected" ') : ($selected = ''); return '' . $Month . ''; } } if ($type == 'years'){ /* The Years */ return '' . $YYY . ''; /* $5YY = $YYYY + 5; // Returning a dropdown with 5 years for ($i = $YYYY; $i <= $5YY; $i++) { return '' . $i . ''; } */ } } } ?>戼⁲㸯㰊㹢慆慴牥潲㱲戯㨾†慃汬琠湵敤楦敮⁤畦据楴湯›愠摤牰橯捥灴潲散摥⤨椠戼䌾尺睷屷潤浴硡捜湯牴汯瀮灨⼼㹢漠楬敮㰠㹢㜱⼼㹢戼⁲㸯[/code]

It seems that the file is parsed as text.
[/quote]

Look carefully, the comments in the source code file have // whereas the comments in the ouput have /**/ which means that it is not this file that is being parsed as text but some other. Check if you have copies of the file named as anything other than controller.forms.php, eg. controller.forms.txt etc. and it is that other copy that is being included. Possibly because it is not a .php file, it is being parsed as text. Let us know what happened. Other than that, all I can think of is checking your include path and checking for single inclusion , i.e. trying to make sure that the code is getting included from only one place.

HTH,
JS
jsdev
 
Posts: 7
Joined: 04. October 2005 08:18


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 61 guests