I want to make two short by options for the users to be able to check out the most recent uploads and the ones with the most views. The query works fine but i dont know how to make the link (<a href="") work.
I made this change on the .htaccess file

RewriteRule ^audios&([0-9]+)$ audios.php?recent=true
RewriteRule ^audios&([0-9]+)/$ audios.php?recent=true

the variable $base_url works fine

Here is the code:

<a href="'.$base_url.'audios&recent=true">Most Recent</a>
<a href="'.$base_url.'audios&most=true">Most Viewed</a>

                            if (isset($_GET['recent']) && ($_GET['recent'] == 'true'))
                            {
                                $Order = " ORDER BY M.created DESC";
                            }
                            else if (isset($_GET['most']) && ($_GET['most'] == 'true'))
                            {
                                $Order = " ORDER BY M.views_count DESC";
                            }

the .php file is called audios.php

Anyone?

Member Avatar for iamthwee

You have a specific rewrite rule for that? Why on earth would you do that?

Can you show the right way to do the href?

Member Avatar for iamthwee

I'm not sure I understand. Just simply create a link 'most recent' but call a different sql query, I don't understand the need for a htaccess file can you explain?

i thought that it will be a good idea to loose the .php extension and simply create the link. I guess thats wrong. How will the link be?

Member Avatar for iamthwee

If you want to loose the php extension I think it should be site wide, and not just for one thing. If you pick a good php framework most have site friendly urls.

Can you post an example?

Member Avatar for iamthwee

Not really, choosing a PHP framework is up to you and will require a learning curve. I would say codeigniter but I'm biased to say that having used it now for a few months. Laravel might be a better option.

Otherwise you'll have to write your own rewrite rules for you web app. It is fraught with pitfalls.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.