Jump to content

bare_nature

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.scoresinmotion.com

Profile Information

  • Gender
    Not Telling

bare_nature's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, Can you guys recommend me a good resource or tutorial for dealing with escaped values and preventing them from interfering with your code? What I mean is the following: When I process form values and prep them for mySQL, I do the following: - trim($value) - htmlentities(stripslashes($value)) - str_ireplace("script", "blocked", $value) - mysql_real_escape_string($value) I end up with mySQL-safe input values (which is my primary concern). However, due to the escaped stuff and htmlentitized values, I have to do a bit of processing to have html-input render well in the browser. My main problem are escaped quotes (single and double). Take this example: <input name='form_field' value='<?php echo $object->value; ?>' /> Now, imagine the value of $object->value being "It\'s a good example." the problem is that the single quote will not be escaped, it seems. In short, I'm confused and forgive me my newbie-ness. As I mentioned earlier, I think I need a solid foundation on how and when to use single and double quotes, how to properly escape them and make sure they are displayed correctly at all times. All help is more than welcome. Thanks, Bart
  2. Hello, In spite of he many threads on this forum about mod_rewrite, I couldn't find what I was looking for (although I'm sure the solution is out there somewhere). My question: The root folder of my website contains three folders "includes", "logs", and "public". With mod_rewrite, I want to make sure that visitors automatically end up in "public". How do I go about doing this? I tried this with the following line in my .htaccess (in the root folder): DirectoryIndex public/index.php It seems, though that all my links are broken when I do so. It can't find stylesheets or images anymore. As you might have guessed, I'm quite new to mod_rewrite and am eager to learn, help is more than welcome! Bart
  3. I'm gonna try this tonight and will thank you on my knees if this works . Thanks for the link Haku!
  4. Well, I have been trying to create a layout for days now, but had to give it up. Normally I am stubborn like hell, but the deadline wins it this time. I wanted to create a layout like that of Smashing Magazine, that is, full width header, full width footer, but the footer needs to stay at the bottom of the page at all times. If the content is not filling the whole page then the footer must remain at the bottom of the page. The problem I ran into was that the body (height: 100%) only took up the viewport (not the entire page) when the main content was larger than the viewport. The consequence was that my footer (given an absolute position at the bottom) also stayed at the bottom of the viewport and not the full page (which resulted in a strange effect). If I would use float: left and clear: both for the footer, then it wouldn't stay at the bottom if the content does not fill the entire page. I hope you get the idea. I started this thread as a last resort, but don't expect to find a definitive answer. I'm just baffled that I couldn't find the solution . Thanks for your time anyway. It is much appreciated. Bart
  5. Thanks for your reply, Haku. I really tried everything I could think of before starting this topic. Even when I set html to height: 100%, the body remains to only occupy the viewport and not the full page. I tested this in Safari and Firefox.
  6. Stating it as global does indeed work. I think this will be my best option. Thanks for your input, guys! Bart
  7. Hello, I have read several posts about this on this forum and other fora, but I don't see any solutions. The question is dead simple, why is it that when the body is assigned a height of 100% that it only fills the viewport and not 100% of the page? First of all, I don't see any use for this and second, it is illogical. Are there fixes for this? It would make my day if one of you CSS experts would give a straightforward answer to this question. Thanks a lot! Bart
  8. I don't see why this should be a problem since the function returns a variable. I do this quite often without any (fatal) problems. The include is done like this: include_layout_template("admin_header.php"); And the function "include_layout_template" looks like this: function include_layout_template($template="") { include(SITE_ROOT.DS.'public'.DS.'layouts'.DS.$template); } SITE_ROOT is a constant and DS is the directory separator.
  9. The variable is not inside a function. A var_dump results in NULL as PHP tells me that the variable is undefined. At the moment, I don't have access to it form within the header.php. Thanks for your time, guys!
  10. I use absolute paths, but to clarify everything I'll add some code snippets. In the main php page I first call require_once("initialize.php"), which pulls in all my classes including Foo. LIB_PATH is a constant and is the absolute path to the site root. DS is simply the directory separator. initialize.php: require_once(LIB_PATH.DS."foo.php"); foo.php: class Foo { private $random_variable = false; public function give_me_random_variable() { return $this->random_variable; } } $foo = new Foo(); With the above in mind, $foo is available on the main php page (I tested this thoroughly). However, my main php page is composed of a header and footer I include using a function that uses include with an absolute path to the site root. In the header I want to access $foo, but this is not possible for several reasons. header.php: if (isset($foo->give_me_random_variable())) { // Do stuff } The question is, how do I get access to $foo in header.php as it is not in the main flow of the page. Bart
  11. I have access to the instance of the object (let's call id $foo) in the main stream, but not in header.php. My question is which approach I should take to have access to $foo in header.php (which is included and therefore not in the main stream)?
  12. The topic title is rather vague so let me explain my problem with a code snippet: <?php require_once("initialize.php"); include("header.php"); ?> body of the page <?php include("footer.php"); ?> In initialize.php I create an instance of a class (let's name it "Foo") so it is readily available to me by requiring initialize.php. So far so good. By including header.php I include the typical header information that is consistent throughout the website. However, in this header.php, I want to call the instance of Foo, I made, but it seems I have no access to that instance. How do I go about to have access to that instance of Foo in header.php? I hope everything is clear. Advise and suggestions are welcome! Bart
×
×
  • 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.