chop Posted March 7, 2013 Share Posted March 7, 2013 I simply want to use the predefined constant CONTENT in place of the "textFiles/" below. define ('CONTENT','../textFiles_content/'); $handle = fopen('textFiles/'.$category.'.html', "r") or die("Couldn't open this file."); I can't get the syntax to work. Link to comment Share on other sites More sharing options...
HartleySan Posted March 7, 2013 Share Posted March 7, 2013 What's the problem with the syntax? You're not even trying to use the constant you defined. When you define a constant in PHP, you don't need to place a dollar sign ($) before the constant. In other words, to refer to the constant 'CONTENT' you are defining, simply type the following: CONTENT 1 Link to comment Share on other sites More sharing options...
chop Posted March 7, 2013 Author Share Posted March 7, 2013 I was using CONTENT as my constant without a $ but didn't remove the single quotes within the fopen(). For some reason I thought they had to be there. Okay with it now... thanks Link to comment Share on other sites More sharing options...
HartleySan Posted March 7, 2013 Share Posted March 7, 2013 Yeah, I guess it is a bit confusing since you define a constant using a string, but when you use it, it's not a string (i.e., you don't use quotes). Anyway, glad you resolved it. Link to comment Share on other sites More sharing options...
Recommended Posts