Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Portfolio websites using PHP and categories

Featured Replies

It will use a database to store all the work and then gets the work to display given by name called in the address bar (eg. http://www.qubik.com/category.php?cat=Branding)

 

This can be done pretty easily with mysql and php. This website tells you everything you'll need to know how to do it!

  • 1 month later...
  • Author

Haven't seen a site that uses those horrible urls like that for a while. At OP: have a read up on SEO urls - as they are pretty much standard practice nowadays.

 

 

What do u mean horrible?

Any suggestions on how to go on about this instead?

 

thanks

Haven't seen a site that uses those horrible urls like that for a while. At OP: have a read up on SEO urls - as they are pretty much standard practice nowadays.

 

talking of horrible urls, Opera tidies them up for you in the browser. No idea why it does so lol

  • Author

oh yes. :)

 

I assume that this is something that can be achieved in development process as well?

Yes, will have to look that up.

 

In any case, if there's an article/guide/site you find appropriate to check out regarding, please let me know.

 

Thanks.

Instead of creating your own system, which could be risky as it's your first time developing one. Why not use a pre-made system with plugins such as Wordpess. This allows you to create catagories, post under them categories etc. and all you have to do is use a pre-made template or create your own.

 

If you really want to create your own, create a new row within your database table called 'catagory'. You would then add this to the end of your URL:

 

?catagory=general

 

Then, within the file you are using to fetch your news data have something like the following:

 

if(isset($_GET['catagory'])) {

$catagory = strip_tags($_GET['catagory']);

mysql_query("SELECT * FROM `news` WHERE `catagory`='$catagory' ORDER BY `date` DESC LIMIT 5");

} else {

mysql_query("SELECT * FROM `news` ORDER BY `date` DESC LIMIT 5");

}

 

^This is just a basic example, as it doesn't include multi catagories etc. hope it helped!

In relation to SEO friendly URL's and the earlier post about horrible URL's, one method to achieve the URL tidying would be to use .htaccess and $_GET[''] hand in hand.

 

You would have something like so: page.com?url=param1/param2/param3

 

so in essence you've got one $_GET string which is actually like this "param1/param2/param3".

 

You would then want to explode this using $arr = explode("/",$_GET['url']);

 

To get each segment you could then array_shift or just target the section you would directly. If you know how many sections you want to a url parameter use arrayshift, if not. then use the references directly.

 

So lets assume you want to work with a category then query a particular category id, you could have a url like this: www.site.com/category/1

You would set up the $arr like so:

 

$arr[0] is your first argument. So you know the site page being requested is categories.

$arr[1] would be the category id, base your query off of that.

I really disagree to people jumping to Wordpress for simple web projects where thousands upon thousands lines of code are not needed :)

 

I completely agree with this. Everyone wants to use Wordpress for everything nowadays. Thousands of lines of code as you say, loads of tables in the db, etc. - just to achieve one or two simple things. It makes things unnecessarily bloated.

The OP wants to display a simple category listing and list of products within a category simialr to http://www.qubik.com/category.php?cat=Book - imo using WordPress for something that simple is total overkill and if he hasn't used Wordpress before, he much more likely to run into time consuming problems learning how to template using Wordpress. I really disagree to people jumping to Wordpress for simple web projects where thousands upon thousands lines of code are not needed :)

 

The title states 'Portfolio Website using PHP and catagories' Wordpress isn't 'overkill' for a portfolio website, in fact, it's very useful for portfolio websites. Fair enough, if he was creating a website where it was JUST for catagories I can see why you wouldn't use wordpress. In this situation, Wordpress can be successfully used and manipulated to what he wants it to do.

  • Author

Thanks for all the replies..

To be honest, the Wordpress solution is kind of relevant, but yes, it would mean trying to strip things down to a bare minimum to get a result that seems achievable from the other way around....from scratch.

 

That's the impression i'm under anyway :)

 

The only thing that would make me go with Wordpress is that my client then would be able to manage his website by him self, without having to call me up to update the site adding a new project or new category etc.

 

I will soon start developing this so watch out,

I am sure I will be back for more PHP magic!

 

 

thanks again.

  • 1 month later...
  • Author

Hello,

 

Returning after some time to state that I am still lost!

 

I have purchased this book

 

Learning PHP, MySql & Javascript

 

but I feel too intimidated to begin.

 

Do you think the website you proposed is easier to follow?

Is there any other resource aimed directly at this sort of dynamic site?

Is HTML5 another option...?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.