Jump to content

imperatormk

Members
  • Posts

    15
  • Joined

  • Last visited

imperatormk's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. That is exactly I am planning to do. Thank`s a lot!
  2. That was the initial idea, but I didn`t have a clue how to implement it. Using sessions, it makes sense. I yet need to find out how to see if category or subcategory is selected, but that should not be a problem. Thank`s for the tip
  3. The buttons that links to a certain page are the whole problem, because of how the whole thing is coded. I transfer the 'catId' via URL, as well as the page number. Here is some code: $paginate.= "<a href='index.php?page=$lastpage'>$lastpage</a>"; This href needs to be modified so it adds another argument (that is 'catId') and keeps the same number when different pages are selected.Never thought about a session though. Maybe I can store the current category until the user selects another maybe? But that equals to another problem: what if a subcategory is selected instead of category? I know, too little code, but no clue what else you might need.
  4. Hey, I need an idea how to use $_GET with multiple args. I actually can join them with an "&", but there is something else. I am using pagination, with 'page' argument for the page number, and I want to add 'catId' as Id for the category that is currently selected. The problem is, everytime I change the page number, the 'catId' disappears. I need a way to change the page arg with leaving the other one intact. Hope this is clear enough, thank you!
  5. No idea, I checked some other sites on the same host - there was nothing like this... Ugh, I am pretty sure it`s their fault though. Hopefully they have some kind of customer support system or something.
  6. Hey, I have a really weird issue. For unknown reasons, when I add a <html> tag to a .php document, and upload it online, it automatically creates script for using 'gostats.com'... Just take a look of the overall code: <?php echo ' <html> </html>';?> ...and the output is: <html><head></head><body><div style="text-align: center;"><div style="position:relative; top:0; margin-right:auto;margin-left:auto; z-index:99999"><!-- no ads --><!-- GoStats JavaScript Based Code --><script src="http://gostats.com/js/counter.js" type="text/javascript"></script><script language="javascript">var _go_js="1.0";</script><script language="javascript1.1">_go_js="1.1";</script><script language="javascript1.2">_go_js="1.2";</script><script language="javascript1.3">_go_js="1.3";</script><script language="javascript1.4">_go_js="1.4";</script><script language="javascript1.5">_go_js="1.5";</script><script language="javascript1.6">_go_js="1.6";</script><script language="javascript1.7">_go_js="1.7";</script><script language="javascript1.8">_go_js="1.8";</script><script language="javascript1.9">_go_js="1.9";</script><script language="javascript"></script><script type="text/javascript">_gos='c2.gostats.com';_goa=637150;_got=5;_goi=1;_goz=0;_gol='web log stats';_GoStatsRun();</script><noscript><a target="_blank" title="web log stats"href="http://gostats.com"><img alt="web log stats"src="http://c2.gostats.com/bin/count/a_637150/t_5/i_1/counter.png"style="border-width:0" /></a></noscript><!-- End GoStats JavaScript Based Code --></div></div></body></html> Tried with DOCTYPE tag, and plethora of other things, and still - this code comes up. I have no idea whatsoever why this happens. If it helps, I *think* I have used this counter on my previous project, but it`s impossible for that to cause problems like this because this is a different domain name (although they are both on the same hosting company). Any suggestions appreciated.
  7. Yeah, actually I haven`t thoroughly checked the JScript code, but there *should* be a way to extract the complete string from there.
  8. Never mind, solved Just use a hidden input box in the form, and use the onsubmit event to set the textarea value to the same. Then use $_POST to retrieve the input box value. onsubmit="elements[\'output\'].value = document.getElementById(\'noise\').value; return true;" (where output is the hidden input box, and noise is the textarea involved.)
  9. I am fairly new to JavaScript, so I might be missing some obvious solution for my question. Here is my issue. I have downloaded and implemented a rich text editor for my website, but now I need to extract it`s value (together with the HTML formatting code) using document.getElementById and to submit it with $_POST to the processing script. Don`t know if I am clear enough, please let me know if you need more info. Thank you!!
  10. You sir just won the internet I`ll see if I manage to write the code on my own. Thank you!!
  11. I could check if the id matches catid or subid, but if that value matches both cat and subid, a problem would arise. I need a way to check what item is selected... btw, I am using this form to see if the post I want to enter is chosen to be placed in a main category or one of it`s subcategories. The result from <select> determines how the further code will handle the input of the post. Tried using 'title' instead of 'id', but so far no results..
  12. So, I have a dropdown list which lists all categories and subcategories of my site as <option>. I need a way to tell if the selected option is a category or subcategory, then export the result to a variable (in php). Here is some code: <select id="dd" onchange="getCatOrSub()" name="option">'; while($row_cat = mysql_fetch_array($result_cat)){echo "<option id='category' value=".$row_cat['id'] . " >" . $row_cat['category'].'</option>';while($row_sub = mysql_fetch_array($result_sub)){if ($row_sub['id']==$row_cat['id']){echo "<option id='subcategory' value=".$row_sub['subId'] . " >" . " ".$row_sub['subcategory'].'</option>…}}mysql_data_seek($result_sub, 0);} Thank you! EDIT: I tried to get the ids of the options using this script, but it didn`t work out: <script type="text/javascript">function getCatOrSub(){var dropd = document.getElementById("dd");'.$CatSub.' = dropd.options[dropd.selectedIndex].id;};</script>
  13. Joining the tables rendered strange results, likely because I am not sure what am I doing. (sorry for the ignorance lol) However, I found a solution, though probably not very efficient one: $cat_list = mysql_query("SELECT * FROM kategorii");$result_test = mysql_query("SELECT articles.artId, categories.category, categories.id FROM categories INNER JOIN articles ON categories.Id=articles.Id ");$result_test = mysql_query("SELECT artikli.artId, artikli.Naslov, artikli.Tekst, artikli.Data, kategorii.kategorija, kategorii.id, kategorii.txt_cat FROM kategorii INNER JOIN artikli ON kategorii.Id=artikli.Id "); $cat_posts = ''; while($row_cat = mysql_fetch_array($cat_list)) { while($row_test = mysql_fetch_array($result_test)) { if ($row_test['id']==$row_cat['id']) { $cat_posts += 1; } } echo '<li class="cat-item"><a href='.$settings['site_url'].'index.php?id='.$row_cat['id'].' \'>'.$row_cat['category'].' - '.$cat_posts.' </a></li>'; $cat_posts = 0; mysql_data_seek($result_test, 0); } It might come useful to someone who comes across this post. I`ll think about the GROUP BY statement later, just in case I find it useful somewhere else. Thank you for your effort, guys!
  14. Thank you for the answer! As far as I tried, COUNT works fine, but lists the number of total posts, in all categories. (probably) I somehow need to change the category.id value which is going to be compared with the article.id every new cycle... (something like query inside query?). ..but have no idea how to do it... Any ideas appreciated.
  15. Currently I have this: $cat_list = mysql_query("SELECT * FROM categories"); while($row_cat = mysql_fetch_array($cat_list)){// prints out all categories from the 'categories' table.} I have an articles table, connected with the categories table with a key (column id). What I need is to get the list of the categories, and have the number of posts next to the names. Thank you! PS. I hope this the right category for this question
×
×
  • Create New...