Jump to content

Listing files in a directory


Cupcake

Recommended Posts

Be easy on me, I'm a n00b at PHP.

 

I have an idea of what I want to do, but no idea how to get started or where to begin.

 

I write an entertainment+technology blog that I'm converting to a more stylish website.

On each article page, I have a section where it shows the last 5 most recent additions to that section, and then a link to the complete archive.

 

I'm guessing I would call for a list of the recent file additions to the directory with a limit at 5.

For the complete archive, I'd like to have a snippet of the article beneath the link/title, and limited 10 or 20 to a page. Once it reaches that limit, it creates a new page of archives.

 

I'm not asking anyone to code it for me. I'm just looking for someone to point to references or specific functions that can do this for me (and so I can customize the output). I'm trying to make my site really dynamic, so that I don't have to go and manually add a link to the archive, update 50+ articles to add a new link or take off an old one. It's not content heavy at the moment (nor is it completed) so I have time to play around with and learn PHP more (I tried years ago and it looked like gibberish to me then) as my site grows, but I'd really love some help on where to start with this idea.

Link to comment
Share on other sites

You'll probably make life easier for yourself if you have a database. Though it might not be necessary for what you want to do right now, it will make things easier to add in the future.

 

For example, what happens when you want to display your archives month by month? Or what happens when you want to add a search feature?

 

You might want to take a look at a CMS. It could save you lots of time on the coding, though it will take time to get it to loook how you want.

Link to comment
Share on other sites

With the CMS, I've looked at some, but I really can't seem to customize them. I'm proficient in HTML, Javascript, CSS, and XTML, but i'm looking to broaden my horizons.

 

I got spoiled on Greymatter. I love, love, love it. Their variable system worked spectacularly for me.

 

The only problem with that is that I'd have to install greymatter into each separate directory to run it for three separate locations.

 

Basically, what I'm looking for is another variable system. Where if I put [[header]] or similar somewhere in my page, any code I have set for [[header]] will replace that in file. Basically separating content from logic and design.

 

Or if I have something set to show the 5 most recent additions in that section called [[recent]], anywhere I put [[recent]], that code will appear in the source. Am I making any sense? Is this even doable with PHP?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.