/    Sign up×
Community /Pin to ProfileBookmark

Help browse multi categories.

Hey whats up everyone ! I just joined this forum hoping to see if anyone can help me figure out this problem I’m having..

I am building a classified website and I would like have it so you can browse the states and cities sorta like craigslist. Now I planned on using wildcard sub-domains to set up all the cities. If I do so is there a way I can set it up where if you click on the state you can browse all the cities at one and/or I want to have an option where you can pick and browse multiple cities at the same time (all in the same state).

I’m very new to all this and learning as I go. I started building the website by teaching myself and coding it all my self but once I got to php and mysql part of it all I kinda said screw it and went to drupal but was to confusing to me to use so now I am using wordpress.

Thank you very much in advance!

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@ericatekkaJan 25.2012 — You'd prob be best building your own frame work instead of using predefined one. but if your going to use one then use Zencart as its a better CMS to use(for what your looking for) than Wordpress which primary role is blogging.

I have a feeling that your probably going to ask alot of questions about how to do this so it would be best if you have no PHP experience that you look for some courses in your local city or try some of the self learn books.

If you have some code already then pop it up and we'll look to at it and advise you on the best way to handle it.
Copy linkTweet thisAlerts:
@RNH524authorJan 25.2012 — Theres no way I could do this without doing all the code myself ? I pretty much have my whole website ready it just piecing it all together now. Is there any ways say if I am to use sub-domains a way to link them together or something to make this happen ? Also isnt Zencart a ecommerce ? Can you even build a classified website out of it ?
Copy linkTweet thisAlerts:
@ericatekkaJan 25.2012 — It is a eCommerce application but with a couple of changes here and there it's a great CMS. Didn't read your first post so I apologies. Lets just take Zencart out of the picture.

When you say you have a whole website ready what do you mean by that?

As for the whole domain you could use a $_SERVER to pull down the sub domain and refer the user to that section of the site.

http://php.net/manual/en/reserved.variables.server.php

something like
[code=php]
$header_loc = substr($_SERVER['SERVER_NAME'], 0, strrpos($_SERVER['SERVER_NAME'], '.'));

header("Location: domain.com/index.php?cat=".$header_loc);//refer the user
[/code]

Then use apache Mod-Rewrite to show the domain as apples.domain.com

Documentation on mod_rewrite

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Apologies if this is all a little confusing. I'm having a brain dead day.
Copy linkTweet thisAlerts:
@RNH524authorJan 25.2012 — Well like I said once I got to the php and mysql from building this website is where i gave up coding it myself... I have all my classifieds and all my states and cities in there. I pretty much have everything i need in my website now I just have to piece it all together. And since I wanted it so you can browse in a city like craigslist I was going to use wildcard sub-domains to do this. But I do want the feature where if you click on the state it'll have all posts from each city in it so say if your looking to buy a car and instead of going city to city looking in each one you can go into the state and browse whats in all the cities. And I would like to make it where say if theres a couple cities by you, you can select the ones you want to look in and then once you search for whatever it is, it will pull up all the ads from those cities you selected.. Sorry if its confusing
Copy linkTweet thisAlerts:
@RNH524authorJan 25.2012 — And if it helps any I have my wordpress installed into my web host...
Copy linkTweet thisAlerts:
@ericatekkaJan 25.2012 — ok, use this the page that the wildcard points to.
[code=php]
$header_loc = substr($_SERVER['SERVER_NAME'], 0, strrpos($_SERVER['SERVER_NAME'], '.'));

header("Location: domain.com/index.php?cat=".$header_loc);//refer the user [/code]


Then on the Index page you could have this up the top.
[code=php]
<?php
$s_Index = (!empty($_GET['cat']))?filter_var($_GET['cat'], FILTER_SANITIZE_STRING):NULL;

$s_SQL =(!empty($s_Index))?"SELECT * FROM TABLE WHERE category = '".$s_Index."' LIMIT 0,50":"SELECT * FROM TABLE LIMIT 0,50";
$run_SQL = mysql_query($s_SQL);
?>
[/code]

You'll need to change the code a bit to fit in with your project but that should get you what you want.
Copy linkTweet thisAlerts:
@RNH524authorJan 26.2012 — I cant find the php to put that .
Copy linkTweet thisAlerts:
@RNH524authorFeb 08.2012 — Can anyone help with to where I would have to put this code and what I would have to do to code it with my website ?
×

Success!

Help @RNH524 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...