My name is Juli, & Im self taught in most of my knowledge on the web, but very new to PHP. Im doing this site for a friend at church. http://tradesupercenter.com
I used Open Classifieds/Hostpel theme. I cant seem to understand either the themes duties or what but when i posted a test ad it will show up when you are posting an ad on the right of the page but when i click on the category I put it under, it goes nowhere…not knowing PHP, Im rather discombobulated…I have NO idea where to look for it, no html pages in file mngr…lol so sorry, Im just confused, seems I learn something every day working on it so I am progressing, its just slow & of course hes in a hurry to get it up & running.
Theres also a javascript on this theme thats supposed to display recent ads that have been posted. I put pics in to simulate but did I mess it up now? will it automatically put new ads there?
I have tried to go to the open classifieds site & use there forum but it says I am not allowed to post there…?
any assistance would be appreciated, ty n advance
I tried and made a ad called TEST DEMO under OTHER
I do not see it either, I am not sure where it is supposed to be directed to. I could not find it in any of the pages script, it may be in the JavaScript… if thats the case someone MIGHT be able to help you here, but this is a PHP HELP
DO you know where the pasted link is to appear? is it supposed to open its own page called index ?
if so something is not loading the index page required to show the item…
without seeing everything function in front of me … it is hard to visualize the outcome…
please let me know I will try to keep digging
reading more into the code I have to say there is a problem with your $location if you changed a location for the saved items to be place on the page… i.e.
/items/other
instead of /other
then this may be the issue… the $location in the seo.php has to match the $location in the .htaccess file…
not knowing what all you have done to the scripts makes it hard to figure what is going wrong since I didnt write the script.
I would start there. It seems that the item is stored in that location.
please let me know.
I have not changed ANY of the PHP. All I have edited is the index.php I have used the Word Press/Hostpel Admin page to edit the categories & do remember changing a location option but i switched it back, but I dont think thats what you are talking about.
I have both the new & the old index, how can I get them to you?
I just got a call & have to run out for a few mins I will brb
can you open the 2 files I was talking about and copy the code inside seperate [php] [/php] tabs
above the smileys on this page ^^^^^^ you see a php button click it and paste each page in its seperate code. both files should be openable in notepad or whatever software you may have otherwise for web design other than frontpage
htaccess.php
[php]<?php
require_once(‘access.php’);
require_once(’…/includes/functions.php’);
$array = parse_url(SITE_URL);
$rewritebase = $array[‘path’];
if ($_SERVER[“SERVER_PORT”]!=“80”) $rewritebase=str_replace(":".$_SERVER[“SERVER_PORT”],"",$rewritebase);
if ($rewritebase=="") $rewritebase="/";
$offer=u(T_(“Offer”));
if ($offer=="") $offer=“offer”;
$need=u(T_(“Need”));
if ($need=="") $need=“need”;
$cat=u(T_(“Category”));
if ($cat=="") $cat=“category”;
$typ=u(T_(“Type”));
if ($typ=="") $typ=“type”;
$new=u(T_(“Publish a new Ad”));
if ($new=="") $new=“new”;
$con=u(T_(“Contact”));
if ($con=="") $con=“contact”;
$pol=u(T_(“Privacy Policy”));
if ($pol=="") $pol=“policy”;
$sm=u(T_(“Sitemap”));
if ($sm=="") $sm=“sitemap”;
$sch=u(T_(“Advanced Search”));
if ($sch=="") $sch=“search”;
$gm=u(T_(“Map”));
if ($gm=="") $gm=“map”;
$ads=u(T_(“Classifieds”));
if ($ads=="") $ads=“ads”;
$alogin=u(T_(“Login”));
if ($alogin=="") $alogin=“login”;
$alogout=u(T_(“Logout”));
if ($alogout=="") $alogout=“logout”;
$aforgotpwd=u(T_(“Forgot My Password”));
if ($aforgotpwd=="") $aforgotpwd=“forgot-password”;
$aconfig=u(T_(“Settings”));
if ($aconfig=="") $aconfig=“settings”;
$account=u(T_(“My Account”));
if ($account=="") $account=“my-account”;
$terms=u(T_(“Terms”));
if ($terms=="") $account=“terms”;
$new=u(T_(“Publish a new Ad”));
if ($new=="") $new=“publish-a-new-ad-for-free”;
$aregister =u(T_(“Register new account”));
if ($aregister=="") $aregister=“register”;
$htaccess_content = "ErrorDocument 404 ".$rewritebase."content/404.php
RewriteEngine on
RewriteBase $rewritebase
RewriteRule ^([0-9]+)$ index.php?page=$1 [L]
RewriteRule ^install/$ install/index.php [L]
RewriteRule ^admin/$ admin/index.php [L]
RewriteRule ^rss/$ content/feed-rss.php [L]
RewriteRule ^manage/$ content/item-manage.php [L]
RewriteRule ^$new.htm content/item-new.php [L]
RewriteRule ^$con.htm content/contact.php [L]
RewriteRule ^$terms.htm content/terms.php [L]
RewriteRule ^$pol.htm content/privacy.php [L]
RewriteRule ^$sm.htm content/site-map.php [L]
RewriteRule ^$sch.htm content/search.php [L]
RewriteRule ^$gm.htm content/map.php [L]
RewriteRule ^$aregister.htm content/account/register.php [L]
RewriteRule ^$alogin.htm content/account/login.php [L]
RewriteRule ^$alogout.htm content/account/logout.php [L]
RewriteRule ^$aforgotpwd.htm content/account/recoverpassword.php [L]
RewriteRule ^$aconfig.htm content/account/settings.php [L]
RewriteRule ^$account/$ content/account/index.php [L]
RewriteRule ^$offer/(.+)/(.+)/$ index.php?category=$1&type=0&location=$2 [L]
RewriteRule ^$offer/(.+)$ index.php?category=$1&type=0 [L]
RewriteRule ^$need/(.+)/(.+)/$ index.php?category=$1&type=1&location=$2 [L]
RewriteRule ^$need/(.+)$ index.php?category=$1&type=1 [L]
RewriteRule ^$ads/(.+)/([0-9]+)$ index.php?location=$1&page=$2 [L]
RewriteRule ^$ads/(.+)/$ index.php?location=$1 [L]
RewriteRule ^(.+)/(.+)/(.+)/$ index.php?category=$2&location=$3 [L]
RewriteRule ^(.+)/(.+)/$ index.php?category=$2 [L]
RewriteRule ^$cat/(.+) $1/ [R=301,L]
RewriteRule ^(.+)/(.+)/(.+)/([0-9]+)$ index.php?category=$2&location=$3&page=$4 [L]
RewriteRule ^(.+)/$ index.php?category=$1 [L]
RewriteRule ^(.+)/(.+)/([0-9]+)$ index.php?category=$2&page=$3 [L]
RewriteRule ^(.+)/([0-9]+)$ index.php?category=$1&page=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/(.+)/(.+)/(.+)$ /$3/$4-$1.htm [R=301,L]
RewriteRule ^(.+)/(.+)/(.+)-([0-9]+).htm$ item.php?category=$2&item=$4 [L]
RewriteRule ^(.+)/(.+)-([0-9]+).htm$ item.php?category=$1&item=$3 [L]
";
//saving htaccess
if(is_writable(’…/.htaccess’)){
$file = fopen(’…/.htaccess’ , “w+”);
if (fwrite($file, $htaccess_content)=== FALSE) {
$msg=T_(“Cannot write to the configuration file”)." ‘.htaccess’";
$succeed=false;
}else $succeed=true;
fclose($file);
}
else {
$msg=T_(“The configuration file”)." ‘/.htaccess’ “.T_(“is not writable”).”. “.T_(“Change its permissions and try again”);
$succeed=false;
}
if ($succeed) jsRedirect(SITE_URL.”/admin/settings.php?msg=".T_(“Updated”));
else echo $msg;
die();
?>[/php]
seo.php
[php]<?php
////////////////////////////////////////////////////////////
//SEO generator
////////////////////////////////////////////////////////////
//metas implemented in header.php
//item
if (isset($idItem)) {
//title
$html_title=$itemTitle;
if (isset($itemType)) $html_title.=’ '.ucwords(getTypeName($itemType));
if ($itemLocation!="") $html_title.=" “.getLocationName($itemLocation);
if ($itemPlace!=”") $html_title.=" “.$itemPlace;
if ($itemPrice!=0) $html_title.=” ".getPrice($itemPrice);
//to display the category in the title uncomment this:
/*$html_title.=SEPARATOR;
if ($categoryParent!=0) $html_title.=$selectedCategoryName. " ";
$html_title.=$categoryName.SEPARATOR;*/
//end title
$html_description=$itemDescription;
}
//Smart 404
elseif(strpos($_SERVER[“SCRIPT_NAME”], “404.php”)>0){
$html_title.=u($SERVER[“REQUEST_URI”]).SEPARATOR.SITE_NAME;
$html_description=$html_title;
}
//for new item
elseif(strpos($SERVER[“SCRIPT_NAME”], “item-new.php”)>0){
//title
$html_title=T(“Publish a new Ad”).SEPARATOR;
if (isset($categoryName)){//new item with category selected
if ($categoryParent!=0) $html_title.=$selectedCategoryName. " ";
$html_title.=$categoryName.SEPARATOR;
}
//else $html_title.=getCategories().SEPARATOR;
$html_title.=SITE_NAME;
//end title
$html_description=$html_title;
}
//categories
elseif (isset($categoryName)) {
//title
//$html_title=T(“Classifieds”)." “;
if (isset($type)) $html_title.=ucwords(getTypeName($type)).SEPARATOR;
$html_title.=$categoryName.SEPARATOR;
if ($categoryParent!=0) $html_title.=$selectedCategoryName.SEPARATOR;
if ($location!=”") $html_title.=getLocationName($location).SEPARATOR;
$html_title.=SITE_NAME;//.SEPARATOR;
//end title
$html_description=$categoryDescription;
}
elseif ((strlen(cG(“title”))>=MIN_SEARCH_CHAR) || strlen(cG(“s”))>=MIN_SEARCH_CHAR){//search
if (cG(“title”)!="")$html_title.=cG(“title”).’ ‘;
if (cG(“s”)!="")$html_title.=cG(“s”).’ ‘;
if (cG(“place”)!="")$html_title.=cG(“place”).’ ‘;
//$html_title.=SITE_NAME;
$html_description=$html_title;
}
//home and RSS home
elseif ( ($_SERVER[“REQUEST_URI”]=="/"||(isset($type)&&!isset($categoryName))||isset($page)) || strpos($SERVER[“SCRIPT_NAME”], “feed-rss.php”)>0) {
//title
//$html_title=T(“Classifieds”)." “;
if (isset($type)) $html_title.=ucwords(getTypeName($type)).SEPARATOR;
if ($location!=”") $html_title.=getLocationName($location).SEPARATOR;
//$html_title.=getCategories().SEPARATOR;
$html_title.=SITE_NAME;
//end title
if (SITE_DESCRIPTION!=’’) $html_description=SITE_DESCRIPTION;
else $html_description=$html_title;
}
//search form
elseif(strpos($SERVER[“SCRIPT_NAME”], “search.php”)>0){
$html_title.=T(“Advanced Search”).SEPARATOR.SITE_NAME;
$html_description=$html_title;
}
//contact form
elseif(strpos($SERVER[“SCRIPT_NAME”], “contact.php”)>0){
$html_title.=T(“Contact”).SEPARATOR.SITE_NAME;
$html_description=$html_title;
}
//sitemap
elseif(strpos($SERVER[“SCRIPT_NAME”], “site-map.php”)>0){
$html_title.=T(“Sitemap”).SEPARATOR.SITE_NAME;
$html_description=$html_title;
}
//privacy
elseif(strpos($SERVER[“SCRIPT_NAME”], “privacy.php”)>0){
$html_title.=T(“Privacy Policy”).SEPARATOR.SITE_NAME;
$html_description=$html_title;
}
// common in all
if (isset($page)&&$page>1) $html_title.=SEPARATOR.T_(“page”)." ".$page;
//better SEO with phpSEO class http:/neo22s.com/phpseo
$seo = new phpSEO($html_title,CHARSET);
$html_keywords= $seo->getKeyWords(5);
$seo = new phpSEO($html_description,CHARSET);
$html_keywords.=", ". $seo->getKeyWords(15);
$html_description= $seo->getMetaDescription(160);
unset($seo);
///////FUNCTIONS////////////////////////////////////////////
////////////////////////////////////////////////////////////
function itemURL($idPost,$category,$type,$title,$subcat=""){//returns de url for the item, if you change this be aware that you need to change it in the .htaccess as well.
if(FRIENDLY_URL){
if ($subcat!="" && $category!=$subcat) $url=’/’.$subcat.’/’.$category.’/’.friendly_url($title).’-’.$idPost.’.htm’;
else $url=’/’.$category.’/’.friendly_url($title).’-’.$idPost.’.htm’; // old= “/$idPost/$type/$category/”.friendly_url($title);
}
else $url="/item.php?item=$idPost&type=$type&category=$category&title=".friendly_url($title);//no friendly url activated
return $url;
}
////////////////////////////////////////////////////////////
function catURL($category,$subcat="",$location=""){//returns de url for the category, if you change this be aware that you need to change it in the .htaccess as well.
if (LOCATION){
if (isset($location)) if ($location=="") global $location;
$locationurl = "";
if ($location!=""){
if (is_numeric($location)){
if(FRIENDLY_URL) $locationurl = getLocationFriendlyName($location)."/";
else $locationurl = "&location=".getLocationFriendlyName($location);
} else {
if(FRIENDLY_URL) $locationurl = $location."/";
else $locationurl = "&location=$location";
}
if ($category=="" && $subcat == "") $category = strtolower(T_("Classifieds"));
}
if(FRIENDLY_URL){
if ($subcat!="" && $category!=$subcat) $url='/'.$fix.$subcat.'/'.$category.'/'.$locationurl;
else {
if ($category == strtolower(T_("Classifieds"))) $url='/'.$category.'/'.$locationurl;
else {
if ($category!="") $url='/l/'.$category.'/'.$locationurl;
else $url= "/";
}
}
}
else {//no friendly url activated
if ($category!="") $url='/?category='.$category.$locationurl;
else $url= "/";
}
} else {
if(FRIENDLY_URL){
if ($subcat!="" && $category!=$subcat) $url=’/’.$subcat.’/’.$category.’/’;
else $url=’/’.$category.’/’;
}
else $url=’/?category=’.$category;//no friendly url activated
}
return $url;
}
////////////////////////////////////////////////////////////
function typeURL($type,$category){//returns de url for the type, if you change this be aware that you need to change it in the .htaccess as well.
global $location;
if (isset($location)) {
if (FRIENDLY_URL) $params = “/”.getLocationFriendlyName($location)."/";
else $params = “&location=”.getLocationFriendlyName($location);
}
if (!isset($category)) $category=“all”;
if (FRIENDLY_URL) $url=’/’.getTypeName($type).’/’.$category.$params;
else $url=’/?category=’.$category.’&type=’.$type.$params;
return $url;
}
////////////////////////////////////////////////////////////
function newURL(){//returns de url to post new item
global $currentCategory, $location;
if (isset($currentCategory)) $params = “?category=$currentCategory”;
if (isset($location)){
if ($params=="") $params = “?location=”.getLocationFriendlyName($location);
else $params .= “&location=”.getLocationFriendlyName($location);
}
if (FRIENDLY_URL) $url=’/’.u(T_(“Publish a new Ad”)).’.htm’.$params;
else $url=’/content/item-new.php’.$params;
return $url;
}
////////////////////////////////////////////////////////////
function mapURL(){//returns de url for the map
if (FRIENDLY_URL) $url=u(T_(“Map”)).’.htm’;
else $url=‘content/map.php’;
return $url;
}
////////////////////////////////////////////////////////////
function contactURL(){//returns de url for the contact
if (FRIENDLY_URL) $url=u(T_(“Contact”)).’.htm’;
else $url=‘content/contact.php’;
return $url;
}
////////////////////////////////////////////////////////////
function accountPostsURL($type,$category,$email){//returns de url for posts by account
global $location;
if (isset($location)) {
if (FRIENDLY_URL) $params = “/”.getLocationFriendlyName($location)."/";
else $params="&location=".getLocationFriendlyName($location);
}
$account=new Account($email);
if ($account->exists){
$params.="&contact=".$account->id;
}
if (!isset($category)) $category=“all”;
if (FRIENDLY_URL) $url=’’.getTypeName($type).’/’.$category.$params;
else $url=’?category=’.$category.’&type=’.$type.$params;
return $url;
}
////////////////////////////////////////////////////////////
function termsURL(){//returns de url for terms
if (FRIENDLY_URL) $url=u(T_(“terms”)).’.htm’;
else $url=’…/…/content/terms.php’;
return $url;
}
////////////////////////////////////////////////////////////
function privacyPolicyURL(){//returns de url for Privacy Policy
if (FRIENDLY_URL) $url=u(T_(“Privacy Policy”)).’.htm’;
else $url=‘content/privacy.php’;
return $url;
}
////////////////////////////////////////////////////////////
function advancedSearchURL(){//returns de url for the advanced search
global $currentCategory, $location;
if (isset($currentCategory)) $params = “?category=$currentCategory”;
if (isset($location)){
if ($params=="") $params = “?location=”.getLocationFriendlyName($location);
else $params .= “&location=”.getLocationFriendlyName($location);
}
if(FRIENDLY_URL) $url=’<a href="’.SITE_URL.’/’.u(T_(“Advanced Search”)).’.htm’.$params.’">’.T_(“Advanced Search”).’’;
else $url=’’.T_(“Advanced Search”).’’;
return $url;
}
////////////////////////////////////////////////////////////
function accountRegisterURL(){//returns de url for account register
global $currentCategory, $location;
if (isset($currentCategory)) $params = “?category=$currentCategory”;
if (isset($location)){
if ($params=="") $params = “?location=”.getLocationFriendlyName($location);
else $params .= “&location=”.getLocationFriendlyName($location);
}
if(FRIENDLY_URL) $url=SITE_URL.’/’.u(T_(“Register new account”)).’.htm’.$params;
else $url=SITE_URL.’/content/account/register.php’.$params;
return $url;
}
////////////////////////////////////////////////////////////
function accountLoginURL(){//returns de url for account logon
global $currentCategory, $location;
if (isset($currentCategory)) $params = “?category=$currentCategory”;
if (isset($location)){
if ($params=="") $params = “?location=”.getLocationFriendlyName($location);
else $params .= “&location=”.getLocationFriendlyName($location);
}
if(FRIENDLY_URL) $url=SITE_URL.’/’.u(T_(“Login”)).’.htm’.$params;
else $url=SITE_URL.’/content/account/login.php’.$params;
return $url;
}
////////////////////////////////////////////////////////////
function accountLogoutURL(){//returns de url for account logout
if(FRIENDLY_URL) $url=SITE_URL.’/’.u(T_(“Logout”)).’.htm’;
else $url=SITE_URL.’/content/account/logout.php’;
return $url;
}
////////////////////////////////////////////////////////////
function accountRecoverPasswordURL(){//returns de url for account password recovery
if(FRIENDLY_URL) $url=SITE_URL.’/’.u(T_(“Forgot My Password”)).’.htm’;
else $url=SITE_URL.’/content/account/recoverpassword.php’;
return $url;
}
////////////////////////////////////////////////////////////
function accountSettingsURL(){//returns de url for account settings
if(FRIENDLY_URL) $url=SITE_URL.’/’.u(T_(“Settings”)).’.htm’;
else $url=SITE_URL.’/content/account/settings.php’;
return $url;
}
////////////////////////////////////////////////////////////
function accountURL(){//returns de url for account
if(FRIENDLY_URL) $url=SITE_URL.’/’.u(T_(“My Account”)).’/’;
else $url=SITE_URL.’/content/account/’;
return $url;
}
////////////////////////////////////////////////////////////
function rssURL(){//returns de url for account
if(FRIENDLY_URL) $url=SITE_URL.’/rss/’;
else $url=SITE_URL.’/content/feed-rss.php’;
return $url;
}
////////////////////////////////////////////////////////////
function itemManageURL(){//returns de url for account
if(FRIENDLY_URL) $url=SITE_URL.’/manage/’;
else $url=SITE_URL.’/content/item-manage.php’;
return $url;
}
////////////////////////////////////////////////////////////
?>
[/php]
I think the error is coming from the script not finding the “location” of the index file the new item is being written to.
I am trying to decipher the two files and it is a bit beyond me the way it is written.
I am thinking there need to be an entry in the seo file for “location” in order for it to find the correct page. it appears to just be redirecting back to the main index and not the index page of the category you are trying to have the item written to.,
this appears to be the issue when looking at the page itself.
However , when you look at the URL bar it does say. http.yadayada.com/something/ this would say it is looknig in the right place just not finding the file there.
someone more advanced would need to look over these but I think the error your having has to do with one of these two files.
Will move to the word press forum you might get more help there.
I really need some help…
ok ?location I need to change it to the address of the category?
Im seeing sitename alot…should that be the site title?
idk man i just dont know