Hi there,
I’m hoping to get a little help with the PHP script for my site www.everything.ie. The site is completely free and funded by myself so I’m afraid I do not have the money to hire a programmer to sort out the problem for me. Besides, I’ve always got great help in the past here so was hoping someone could advise me once again.
Everything.ie runs on a classified script I bought and tweaked for my purpose. I don’t know much about PHP and so can only change the most basic of settings with this limited knowledge.
Here’s the problem. When you click on any of the categories or subcategories on the main page a new one is generated with the listings you choose. At the top of the generated page there is a link allowing you to “Click here to post a new ad in this category.” This is fine in the case of the subcategories but proves to be a problem if you click on one of the main categories (jobs, personals etc). Lots of people keep placing ads into the main category where they are almost impossible to find. I’ve tried posting a warning but I need a more permanent solution as the site is growing fast.
Basically, I need to find a way of stopping the “post a new ad” link coming up when you choose to view all the ads in any main category (eg. jobs, personals etc). I cannot work out how to do this as the script seems to treat both the main categories and the subcategories in the same way.
Now I think this small piece of code is what generates the link:
//
// ============================================================
// generates the text at the bottom prompting to add new listing
// ============================================================
//
function generate_add_listing() {
global $CF_URL;
$url = $_SERVER["PHP_SELF"] . '?cf_action=add&category_id=' . $_GET["category_id"];
$output .= '<center><hr size="1" color="#666666" width="100%">';
$output .= '<p class="cfbody"><a class="cfbody" href="'.$url.'"><img src="'.$CF_URL.'/images/add_new.gif" width="18" height="13" border="0">';
$output .= '</a> <a class="cfbody" href="'.$url.'">Click here to post a new ad in this category.</a> <p> <p class="cfhint">N.B: Please make sure you post your ad in the <b>subcategory</b> of your choice, (eg "apts / houses to let") as opposed to the <b>main category</b> itself (eg. "accommodation"). More people will be able to see your ad if you do this!</p></center>';
return $output;
}
The simplest way I can think to solve the problem is this:
The main category_id’s are all two digit numbers from 01 to 09 while the subcategories have four digit numbers related to the main category number (eg category_id=0101 is the first subcategory of the main category, category_id=01.
Would it be possible to tell the script not to print the “post a new ad” link if the category chosen only has two digits? This seems the simplest way to me of stooping this link from appearing on the pages I don’t want it to.
It’s probably just one or two lines of code I need to add, but I have no idea what they are.
If someone could help me I’d really appreciate it.
I can supply you with the rest of the php script if that helps.
Thanks in advance (again!)
Robert