Jump to content

cugopob.vlad

Member
  • Posts

    24
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

Contact Methods

  • Website
    http://vsid.net

cugopob.vlad's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Im not exactly sure that this will work, as I havent done anything with wordpress in a while, but from what they have on the wordpress functions info at http://codex.wordpress.org/Function_Reference/bloginfo <?php bloginfo('url'); would return http://example/home, so im assuming that you are just missing a backslash in you $path variable. It should look like <?php $path = '/test/test_path/file.php';
  2. cugopob.vlad

    Include All

    Not sure if its been posted before, i tried searching but couldnt really find anything similar to this. Anyway, i put together a little php script that includes all files within the same directory. The purpose of this? Well, if you have a library folder or something similar where you keep all your php scripts, instead of including every single page, you could just include one that would automatically include the rest of them. Now, if you just wanted to include a few select scripts, this obviously wont do you any help. It will also include all files in sub folders. Oh, i forgot to mention that this page would have to be at the root of you php library. If you see any improvements that could be made, please let me know. Thanks! Here's the code: <?php $thisFileFull = __FILE__; $thisFile = basename($thisFileFull); $thisDir = dirname($thisFileFull).'/'; $folders = array(); $files = array(); /* * Scanner: * Scan the directory and store its contents in appropriate arrays * If a file is found, store in $files array * If a directory is found, store in the $folders array */ function scanner($folder) { global $folders,$files,$thisFile; if($_contents = opendir($folder)) //open the directory { while(false !== ($file = readdir($_contents))) //loop through the contents of the directory { if($file == "." || $file == ".."){}else { if(is_dir($folder.$file)) //only processes folders { if(!in_array($folder.$file,$folders))array_push($folders,$folder.$file); //add the folder to folders array if it doesnt already exists } elseif(is_file($folder.$file) && $file != $thisFile) //only processes files and make sure not to include this file, otherwise you'd be in an infinite loop { if(!in_array($folder.$file,$files))array_push($files,$folder.$file); //add the file to files array if it doesnt already exists } } } } } /* * Cleaner: * "Cleans" the folders array */ function clean() { global $folders; foreach($folders as $key => $newFolder) //loop through the folders array { scanner($newFolder.'/'); //send all the results to be rescanned, unset($folders[$key]); //after scanning remove the folder from the array } } /* * Scan through the root and return ALL of the results */ function scan() { global $folders,$thisDir,$files; if(!is_dir($thisDir)) //check to see if the directory is valid before continuing { return false; } elseif(isset($thisDir)) //check to see if the root directory is set { scanner($thisDir); //initial scan of the root directory while(!empty($folders)) //loop through to check if there are any folders in the root directory { clean(); //rescan all folders in the root directory } if(empty($folders)) //checks to see that there are no more folders { return $files; //returns the results(the entire url leading to the file) ex. /var/www/index.php instead of index.php } } } foreach(scan() as $key => $value) { include_once($value); }
  3. The above resolution works with javascript but if you wanted to do it in php you could use the above code would redirect you in 5 seconds.
  4. Send us your feed back: <?php if ($_POST && isset($missing) && !empty($missing)) { ?> Please complete the missing item(s) indicated. <?php } elseif ($_POST && $mailsent = false) { ?> Sorry, there was a problem sending your message. Please try later. <?php } elseif ($_POST && $mailsent = true) { ?> Your message has been sent. Thank you for your feedback. <?php } ?> Name: <?php if(isset($missing) && in_array('name', $missing)) { ?> :Please enter your name <?php }?> Email: <?php if(isset($missing) && in_array('email', $missing)) { ?> :Please enter your email <?php }?> Message: <?php if(isset($missing) && in_array('message', $missing)) { ?> Please enter your Message: <?php }?> <?php if (isset($missing)) { echo htmlentities($_POST['message']); } ?>
  5. Nice video, really cool. Your video is really high quality though i thought it played better on youtube than your site for some reason. Very informative and helped me decide where to go with php. Thank You.
  6. here i would use the conditional statement after you validate all the user input, for example: if($_POST['button']){ mail($to, $subject, $message, $headers); } this way it only sends the message when you push the send button and here what i would do is put the elements into the html. such as and then assign the user input in email the the variable $email like this $email=$_POST['email']; $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = "From: $email" . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
  7. How would i do that? would i just put the php end tag and then put the php start tag again?
  8. cugopob.vlad

    Php in php?

    Is it possible to include php within php? for example, have a function that returns some html code that you want but have php within the html code so that the function would return the html and the php.
  9. cugopob.vlad

    tabs

    sorry i forgot to tell you the css is an external document linked to the html page so there is no html here.
  10. cugopob.vlad

    tabs

    Well here is what i got so far for the menu
  11. cugopob.vlad

    tabs

    hey im making a website with tabs and im checking it on both IE and Opera. the first time i tried it in IE the tabs were positioned on relative and i ajusted the way i needed it. but then i tried the page in Opera and the tabs ended under the body and you couldnt see it. then i tried fixing it so it would work with Opera and then in IE it got messed up. So finally i decided to position the tabs on absolute and i got it the way i wanted and it works in all browsers but they ended up in the background i think because when you move your mouse over it, it doesnt change the color the way its suppose to. Can anybody help me? Thanks.
  12. cugopob.vlad

    stripos

    hey whats the difference between stripos and strripos?
  13. hi i was wondering since i now how to make a form in html i wanted to include an attach file input. thats the easy part. how do i put the php in so that it sends the attached file to my email. Thanks for any help.
  14. ok i guess i dont need javascript then. by the way i heard some good things about css mastery for learning css. Would you agree with that or would you recomend any books for css then. Thanks.
  15. Sorry im really new to web design or other wise a super noob. i read an html book which i learned html from and in it i saw some javascript programing. also i been on many sites and when i look at the source i see a lot of javascript programing. im really intrested in javascript and think its pretty cool but i have no clue where to start. Does anybody know any good books that i would be able to learn from the very start. Thanks in advance for any of your help or suggestions. Thank You.
×
×
  • Create New...