Note that there are some explanatory texts on larger screens.

plurals
  1. POMulti variables by links
    primarykey
    data
    text
    <p>I'm making a news archive. I want the news archive to have several options. At first I want the archive to have the option to only display news posted in a certain year and an option to display only news thats posted in a certain category. These features are both saved in my database at every post so with a small php code I can easily find posts created in e.g 2013.</p> <p>The problem is is that I want to make buttons in my news archive. Buttons that can make the user decide which feature is enabled or not (if you understand what I'm saying). I want the users to have the ability to make sure only posts of e.g 2013 appear on their screen but on the same time only posts of e.g sport news appear. By making two features for the user to enable, I couldn't think of a way linking them to the correct page.</p> <p>If they click on a specific year they will go to article.php?year=2013 for example. But if you also want to use the other feature (category) it's impossible because you will be send to article.php?category=sport for example and the posts will no longer be searched on their published year but only on their category. </p> <p>I want to make sure that if one feature/option is already enabled the other will only add &amp;category=sport at the end of the URL so the URL becomes article.php?year=2013&amp;category=sport which makes sure the user can select multiple features at the same time.</p> <pre><code> &lt;ul class="archive"&gt; &lt;li&gt; &lt;div&gt;Year&lt;/div&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="article.php?year=all"&gt;Every year&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?year=2013"&gt;2013&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?year=2012"&gt;2012&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?year=2011"&gt;2011&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?year=2010"&gt;2010&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;ul class="archive"&gt; &lt;li&gt; &lt;div&gt;Category&lt;/div&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="?category=all"&gt;General news&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?category=sport"&gt;Sport news&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?category=international"&gt;International news&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="article.php?category=national"&gt;National news&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I hope you understand my problem and look forward to hear from some of you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload