Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Im just learning php and wondering what im doin wrong here: $days = '4'; if ($days == '0'); echo 'no days'; else echo '$days';
  2. Is there a simple way to convert a time format like: Fri Dec 19, 2008 4:02 am Into how long ago this time was: 2 days, 15mins
  3. IT WORKS!! Thanks! I can basically pull out anything of a url string by using: <?php echo ''.$_GET['anything'].'' ?> This will be invaluable in the future Thanks again!!
  4. can you elaborate a bit.....please :-\ Heres my directory structure...hope it helps /files/ where swf files are stored /video_player.php where the player macromedia code is located isnt header('Location: index.php'); a redirect to index.php, i cant see how this works
  5. I have about 100 or so swf movies and want to use only one page based on the url the user clicks example: http://www.site.com/video_player.php?1234.swf where 1234.swf is the file so based on the url - file 1234.swf should be displayed within: <p align="center"> <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="935" height="301"> <param name="movie" value="/1234.swf"> <param name="quality" value="High"> <embed src="/1234.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="920" height="520"></object> im just not sure how to go about it....
  6. internet explorer wont play them if it dosent have the plugin....wont even display an error message i may need a little detection script
  7. i have about 10 swf game files i want to put on a page if the user doesnt have flash installed does the browser automatically detect and display a flash download link or do i need to add an if/else script??
  8. whats the point of using subdomains for images, js etc when you can use .htaccess to cache images just seems like less work to add: <FilesMatch "\.(jpg|jpeg|gif|ico)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> instead of creating multiple subdomains
  9. why name pages with different extensions when it comes to php,html,htm,shtml i mean if you have a php page youve stilll gotta use <?php ?> tags within php coding as you would with shtml pages whats the point! I can understand renaming html to shtml considering shtml pages are text based, meaning better indexing, but php still boggles my fragile little mind..?!!?
  10. seems strange that using this code: <?php $time_start = microtime(true); // Sleep for a while usleep(100); $time_end = microtime(true); $time = $time_end - $time_start; echo "Did nothing in $time seconds\n"; ?> the page generation is "Generated in 0.000113010406494 Seconds" but the page loads for 15 seconds - my internet connection is 128kb/s
  11. whats the best method of displaying : Page generated in xx seconds in php pages, where xx is the generation time
  12. why does this str_replace not work? <?php $config = "this is the message"; $ch = str_replace("{config}",$config,$ch); ?> <?php echo $ch; ?> it should show "this is the message"
  13. how can i include pages within {if else} scripts i cant see how i can include: virtual('/templates/nav.php'); into <?php if (isset($_COOKIE['visual_nav'])) echo ""; else echo "included page here"; ?>
  14. I haven't started learning how to develop mysql databases from scratch yet , would this be faster than using php directly??
  15. can i use php within head tags?? im trying to adjust pages based on cookies <head><?php if (isset($_COOKIE['visual_nav'])) echo ""; else echo "<link rel=\"stylesheet\"/style.css\" type=\"text/css\" />"; { if ($_COOKIE['visual_nav'] === 'off') echo "<link rel=\"stylesheet\"/style2.css\" type=\"text/css\" />"; elseif ($_COOKIE['visual_nav'] === 'on')echo "<link rel=\"stylesheet\"/style3.css\" type=\"text/css\" />"; } ?></head> <body></body>
  16. yes i understand the example, but im trying to "echo" the {variable within the page}: im trying to change $config -which is within config.php into {config}- which is in page.htm config.php holds multiple str_replace codes: <?php $config = "this is the message"; $ch = str_replace("{config}",$config,$ch); $config_2 = "config 2 message"; $ch = str_replace("{config_2}",$config_2,$ch); ?> page.htm displays php code by using {} tags <?php virtual('config.php'); ?> {config} {config_2} I pulled this code out of another script I have, $ch is curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_HTTPHEADER, $myHeader); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); // run the whole process curl_close($ch); maybe this isnt a str replace question??
  17. ive simplified the question - ive also tried this way but no luck, logically it should work Is this format a curl option?? <?php $config = "this is the message"; $config = str_replace("{config}",$config); ?> {config}
  18. i want to use a config.php file and string replace the variables within another.php file. but im stuck with the str_replace config.php: <?php $customize = "this is the message"; str_replace("{customize}",$customize); ?> another.php: <html> <head> </head> <body> <? include_once ('/config.php');?> {customize} </body> </html>
  19. im trying to set up this simple cookie script but its a bit buggy - can anyone improve this? <head><script>function set_cookie(object, value) { if (value == 'off') { var message = 'off' } else { var message = 'on' } if(confirm(message)) { var expireDate = new Date() var expstring = expireDate.setDate(expireDate.getDate() + 500) document.cookie = object+'='+value+'; expires='+expireDate.toGMTString()+'; path=/'; window.location.reload() } }</script></head> <?php if (isset($_COOKIE['customize'])) echo ""; else echo ""; if ($_COOKIE['customize'] == 'off') echo "<a href=\"javascript: set_cookie('customize', 'on');\">turn on message</a>"; else echo "<a href=\"javascript: set_cookie('customize', 'off');\">turn off message</a>"; ?>
  20. im trying to set up this simple cookie script but its a bit buggy - can anyone improve this? <head><script>function set_cookie(object, value) { if (value == 'off') { var message = 'off' } else { var message = 'on' } if(confirm(message)) { var expireDate = new Date() var expstring = expireDate.setDate(expireDate.getDate() + 500) document.cookie = object+'='+value+'; expires='+expireDate.toGMTString()+'; path=/'; window.location.reload() } }</script></head> <?php if (isset($_COOKIE['customize'])) echo ""; else echo ""; if ($_COOKIE['customize'] == 'off') echo "<a href=\"javascript: set_cookie('customize', 'on');\">turn on message</a>"; else echo "<a href=\"javascript: set_cookie('customize', 'off');\">turn off message</a>"; ?>
  21. how can i set a cookie with a simple hyperlink and reload() function, without a popup message saying confirm . eg. user clicks a hyperlink and automatically the page gets reloaded and cookie set - no popup message An example of the cookie script i have now - popup version: <a href="javascript: set_cookie('customize', 'on');"><script>function set_cookie(object, value) { if (value == 'off') { var message = 'off' } else { var message = 'on' } if(confirm(message)) { var expireDate = new Date() var expstring = expireDate.setDate(expireDate.getDate() + 500) document.cookie = object+'='+value+'; expires='+expireDate.toGMTString()+'; path=/'; window.location.reload() } }</script>Dont show this message again</a>
  22. is there any benefit by using css to position your content, rather than using tables??
×
×
  • 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.