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.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 08-24-2011, 12:54 PM   #1
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
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
Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-24-2011, 02:41 PM   #2
crazyvipa
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

Last edited by crazyvipa; 08-24-2011 at 02:44 PM..
crazyvipa is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-24-2011, 10:21 PM   #3
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
Thank you very much for this.
I think I can pull this one

Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-25-2011, 11:56 AM   #4
robber
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";}
?>
This would do a simple check to make sure the folder is there, this would be simple as long as you have a picture available for each one on the page which is linking so your picture tags on the page would be some thing like:

Code:
<img src="<?php echo $date; ?>/img1.png">
<img src="<?php echo $date; ?>/img2.png">
<img src="<?php echo $date; ?>/img3.png">
This would do the basics of what you need, but if you were wanting to be a bit more technical, you could add a second check to make sure the file exists, to make this simple it might be easier to write a little function, so under the header section add: (Make sure it is after the date check)
Code:
function fcheck($name){
if(file_exists($date."/".$name)){
return $date."/".$name;
}else{
return "default/".$name;
}}
Then all you would need to do to include the file is:

Code:
<img src="<?php echo fcheck("img1.png"); ?>">
<img src="<?php echo fcheck("img2.png"); ?>">
<img src="<?php echo fcheck("img3.png"); ?>">
Hope this helps, if you are unsure please ask

Kind Regards

Rob
robber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-25-2011, 12:30 PM   #5
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
Quote:
Originally Posted by robber View Post

Hope this helps, if you are unsure please ask

Kind Regards

Rob
Wow, thanks man. I am absolutely going to try this!

Yes, it was part of what I was searching out knowledge for.

Thank you!

Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-25-2011, 01:56 PM   #6
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
Quote:
Originally Posted by robber View Post
Hope this helps, if you are unsure please ask

Rob

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
Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-25-2011, 03:47 PM   #7
robber
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")));
This should read the file and every comma it will put this in a new value in an array, so if your file said:

Quote:
jollyhumper, beer alot, likes
to use the variables from here you just need to echo your array variables so, the following:

Code:
 <?php echo $info[0]." ".$info[2]." ".$info[1]; ?>
Should produce: "jollyhumper likes beer alot" as the variables are set as:

$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

Last edited by robber; 08-25-2011 at 03:49 PM..
robber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-25-2011, 07:30 PM   #8
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
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!

Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-26-2011, 05:10 AM   #9
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
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');
I just
Code:
<?php include("h.php")?>
attop of my galleryfile.

So basically I changed yours
Code:
 $date to $datetoday
It does work like a charm, except for one thing.
If I am trying to put the date-folders into a folder named 'gallery'
Code:
<img src="gallery/<?php echo $datetoday; ?>/001.jpg">
The check routine always ends up with default, probably because the folder ain't on the root. But I can't fuing find out how to alter your code to check for the date inside a gallery folder. What makes me fucking is just that the solution is right infront of me, I should've seen it! argh

SO, someone, a little more input would be appreciated.
The stuff is basically working at pornpitstop right now, in it's most basic form.

Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-26-2011, 11:02 AM   #10
robber
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
}}

?>
Hope this helps

Rob

Last edited by robber; 08-26-2011 at 11:03 AM..
robber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-26-2011, 11:24 AM   #11
jollyhumper
Confirmed User
 
jollyhumper's Avatar
 
Industry Role:
Join Date: Mar 2011
Location: Norway
Posts: 400
Quote:
Originally Posted by robber View Post
Hope this helps
Rob

Very much. I'm nearly there now.

Mrten
__________________
MongerCash - This Asian program converts as hell!. Sign up! |

Tons of Porn
|
Email: Jolly [at] pornpitstop (døt) com | Icq: 619 746 889 |
jollyhumper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-26-2011, 01:03 PM   #12
robber
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)
robber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.