PDA

View Full Version : Random Photo Mod- is it possible?


kickass
08-26-2005, 03:11 AM
vkaryl is building a local directory for the area in which she lives. It's a naturally beautiful place and this directory would benefit from some photos of the area.

I know other scripts have them. Would it be possible to add to this script a mod that would pull a random photo out of a photo directory and add it to the page between the bottom of the cats or links and where the footer begins? We would probably be okay with something that uses a static width. I have a feeling this is something REALLY simple for someone who knows what they're doing (which I don't . . . at least not with php or js)

This would be a nice addition for directories that have subject areas that are visual in nature (like art, maybe? dance? cartooning?)

Anyway, just a thought . . .

David
08-26-2005, 04:51 AM
Yes, this would be very easy. Maybe look over on HotScripts and we can find a mod that displays random links or images. Then we can insert the php right in the smarty template using {php} tags.

Ap0s7le
08-26-2005, 09:48 AM
Actually that's a bad idea, not the image idea but using {php} tags.

Smarty is used so we can seperate the logic from the layout as much as possible. If that line is crossed, then this script becomes slow, hard to modify and against the whole seperation logic, which is *very* important.

This can be done in the logic side of things, it should stay away from the layout side. Just like tables / css, CSS is layout... Tables is Data... same thing :)

I've got to get to bed, and hey David thanks for the chat today. I enjoyed it.

night bro

PS
BJ, this is totally doable. yktan and I both are working on mods right now but we'll get to it for sure.

later!! ;)

-Casey

kickass
08-26-2005, 03:59 PM
Thanks Casey- I think this one comes under "spare time" mods. It isn't vitally important, but it would be fun and would make the directories we build stand out from the crowd.

If you want me to "shop" for code snippets or scripts that are already working like this, just holler. I got from your answer to David that you might want to just write it yourself, but maybe I'm reading that wrong . . .

Mike77
08-27-2005, 10:49 AM
Isnt this easily done by just inserting some code in footer.tpl or something - without the need of some mod? for example here is a simple simple way to display random pic (I didnt try it but it looks so simple):

http://www.auburn.edu/oit/support/students/webpages/ht_random_picture.php

More links here:

http://www.google.nl/search?sourceid=navclient&hl=nl&ie=UTF-8&rls=GGLD,GGLD:2004-45,GGLD:nl&q=display+random+picture+php

added: sorry,I didnt get post from apostle first about separating smarty and code :)

Nobody
08-27-2005, 11:09 AM
Actually, I wouldn't say this is a mod for phpLinkDirectory, as it has nothing to do with it's main purposes: beeing a PHP link directory.

Maybe this sort of has more to do with web design in general. IMHO these issues should be posted in the Design forum. Also try go take a look at www.webmaster-world.com to see if you find any help there, for instance.

The splendid mods coders in here should be busy making related mods for phpLinkDirectory, I think! :D

If you don't find answers at the forum I menitoned above, you may PM me and I'll try to help you out. Web design and SEO I know very well, PHP coding as bit harder for me. Tips: I'd say a JavaScript application would be enough to satisfy your needs.

phpLinkDirectory coders, I totally adore your work! Can't wait until some descent soul has a look on the mod request I've been shouting out for some couple of weeks now (see my signature). :idea:

Nobody
08-27-2005, 11:25 AM
Found this code, maybe this will do. Have a look at it.

Inside the head tags:

Content visible to registered users only.

Inside the body tags:

Content visible to registered users only.

Mike77
08-27-2005, 11:30 AM
BJ,probably I broke all the design and structure rules but I made it work pretty easily.

I just opened index.php and placed this code AFTEr the last line (where PHP ends : ?>)

Content visible to registered users only.

then I uploaded 4 pics from example I got on url in my previous post and it works for main page. I dont know how to do it for other directories but it must be easy solution I guess (adding {$smarty.const.DOC_ROOT} didnt work) - some of PHPLD coders will know for sure how to add root directory before /images/

Probably not what you wanted but good for a start :)

Nobody
08-27-2005, 11:36 AM
Yeah I guess, whatever...

Mike77
08-27-2005, 11:40 AM
I made it work on all pages by modyfing that line a litle:

Content visible to registered users only.

yoursubdir is possible subidrectory where you keep your PHPLD.

Nobody
08-27-2005, 11:44 AM
I have a funny feeling Mike is mistaking me for another one. :roll:

Mike77
08-27-2005, 11:49 AM
Nobody,I was talking to BJ (Kickass) - my first post is reply to her first post and also my second post with links starts with "BJ" (probably her name) - actually none of my posts is aimed or reply to you (Nobody). Also when I was writting follow up to my post you posted 2 posts in the meantime which I didnt see so it might look I was replying to you whcih I was not:)

kickass
08-27-2005, 05:04 PM
Thanks! I'll pass this on to vkaryl, since it's for her directory I had it in mind, though I'm sure I'll use it somewhere down the line. It might work for my soon to be up seek locally directory.

Actually, re the difference between true mods and design add-ons, you're probably right- I've requested from David somewhere down the line that there be a mechanism for this, probably called plug-ins like it is at WordPress and at a few other open-source scripts, that'll extend the script separately from the core code, and available from admin to be activated or deactivated, so when upgrades to the core are made we're not all scrambling to remember what the hell we did to make this or that work (okay, so I'm NOT so organized as to have my mods documented in one simple file . . .)

This will be nice going down the road since it'll allow an almost infinite number of permutations to the script depending on what someone needs it for. I really do hope they institute a plug-in system for the future, since I also think it will attract developers, who always wanna be inventing new gadgets to make sites interesting.

The problem with posting something like this question in the design thread is I'm usually the one answering the questions in there! And I'm not a js or php whiz, my specialty is xhtml/css/templating. I knew it would get seen in here by the right people-- which it was! So beat me with a wet noodle for taking advantage . . .