![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
'o mighty php guru, take a look :)
Hi
I know very little php by now, I understand code, but can't write yet. <?php include 'mypage.html'; ?> would include that html into my php page. But let's say I need it a bit more advanced. Pics sorted by dated folders [2011-08-24] [2011-08-25] Is there a codesnippet that will get the files from correct folder? A la <?php include '<dateoftoday>/filename.html' ?> Or do I then in addition have a small script that actually checks the date to? Cheers M ![]()
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Aug 2011
Posts: 73
|
Something along those lines. You'll need to include a variable. How are you getting the DATE aspect? Is it today's date? Is it always going to be there?
In any case, I'll use today's date for an example. <?php $_today = date("Y-m-d"); include('./[' . $_today . ']/mysupercoolfile.html'); ?> By no means is the above code safe in any way. You should always add checks to see if files exist or php will fire off errors. Use php.net to find out functions and what they do, but is_file() is the function you'd want to use to make sure the file is actually there. Remember that PHP runs in an environment, and usually based on absolute paths (on *nix systems) -- so you may have to use absolute directory structure. Example: "./myw-ww.html" becomes "/var/www/superduper/httpdocs/myw-ww.html" MOST hosting servers use mods that only allow you to access your home www directory, so the above example doesn't matter -- but not all. Hope this helps,
__________________
---- celebnuditywebsites AT gmail.com |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
Thank you very much for this.
I think I can pull this one ![]() M ![]()
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Web Developer
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
|
Hi Morten,
If I'm understanding your original post correctly, you have pictures sorted into files and you want to show specific pictures on specific days, is this going to be a whole site theme or only specific pictures which will change as you could almost set it up so each picture you want to include is checked otherwise you include a default image in its place (so you don't get broken images showing) The top of you file would include some code like: Code:
<?php $date = date('Y-m-d'); if(!is_dir($date)){$date="default";} ?> Code:
<img src="<?php echo $date; ?>/img1.png"> <img src="<?php echo $date; ?>/img2.png"> <img src="<?php echo $date; ?>/img3.png"> Code:
function fcheck($name){ if(file_exists($date."/".$name)){ return $date."/".$name; }else{ return "default/".$name; }} Code:
<img src="<?php echo fcheck("img1.png"); ?>"> <img src="<?php echo fcheck("img2.png"); ?>"> <img src="<?php echo fcheck("img3.png"); ?>"> Kind Regards Rob |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
Wow, thanks man. I am absolutely going to try this!
Yes, it was part of what I was searching out knowledge for. Thank you! M ![]() ![]()
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
I did some experimenting and it sure did work. But if I could add another question, I think I have all I need to complete the first project. (But if this is to advanced, just forget it, I'll eventually get the knowledge as I work my way through "learn PHP" books.) If Each folder had a text-file (or a XML-file) would it be difficult to pull out the info and put onto the picture-loaded page? SOmething like this: read xml and find attribute Name of Model, include it. read XML and find attribute ShortText and include it. Read XML and find attribute "BuyTheseGoodGFY-guys a beer", then do it! Thx M ![]()
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#7 | |
Web Developer
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
|
Morton,
It's simple enough to have it read the file, following on from what was in the previous example, you could get it to read through the information and then include the results so you could almost do: (under the current header info) Code:
$info = explode(",",file_get_contents(fcheck("info.txt"))); Quote:
Code:
<?php echo $info[0]." ".$info[2]." ".$info[1]; ?> $info[0] = "jollyhumper" $info[1] = "beer alot" $info[2] = "likes" Hope this answers your question (this also uses the revert to default setting), just drop a blank file in with the name and it will mean no errors will come up. Just one amendment to my original code needs doing, if you drop an @ infront of the file_exists so it reads @file_exists, it basically surpresses any error messages created by the function. (I forgot to add this originally) If you have any questions about what this is doing and how you can expand it, please ask Hope this answers your question Rob |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
Well, here is my experiment. Everything except the word "meet" is picked up from PHP commands
![]() Hostinggallery.net The ideas just comes streaming in ![]() thanks! M ![]()
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
I',m using Zorgman's TEVS, quite happy with it.
I am trying to include this code in one of my tubes. Now; Zorgman already have a datecheck in the header.file; which is: Code:
$datetoday = date('Y-m-d'); Code:
<?php include("h.php")?> So basically I changed yours Code:
$date to $datetoday If I am trying to put the date-folders into a folder named 'gallery' Code:
<img src="gallery/<?php echo $datetoday; ?>/001.jpg"> ![]() ![]() ![]() SO, someone, a little more input would be appreciated. The stuff is basically working at pornpitstop right now, in it's most basic form. M ![]()
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#10 |
Web Developer
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
|
Hi Morten
To use the coding i provided then you want to use: Code:
<?php $date = date('Y-m-d'); if(!is_dir($date)){$date="default";} ## Amend this to: ## if(!is_dir("gallery/".$date)){$date="default";} function fcheck($name){ if(file_exists($date."/".$name)){ ## Amend this one to: ## if(@file_exists("gallery/".$date."/".$name)){ return $date."/".$name; ## Amend this one to: return "gallery/".$date."/".$name }else{ return "default/".$name; ## Amend this one to: return "gallery/".$date."/".$name }} ?> Rob |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
|
__________________
MongerCash - This Asian program converts as hell!. Sign up! | Tons of Porn| Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#12 |
Web Developer
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
|
You're welcome feel free to contact me if you want help outside of the board
Rob - ([email protected] <-- Replace the 0's with o's) |
![]() |
![]() ![]() ![]() ![]() |