UPDATE:
In the new version 3.2 you can use city/region based subdomains. where the ads are shown based on the subdomain selected.. in short you do not need this mod if you are using the subdomain feature...
I recommend that you upgrade you osclass to 3.2...
I have updated my site to 3.2 and the example links below point to 3.2 now and are not related to the tutorial now..
==========================================
Thanks for your pm and request. Sorry I was not feeling well and could not do it however I am here to show how to make OSClass sexy.
This tutorial is based on Modern theme (OSCLASS 3.0.1) however it can be implemented in any version of Osclass and themes.
For twitter boot strap you can see
http://jamal.pk OK here we go
* Install Osclass if needed
* Create page in admin menu and give it title as "myhome", internal name "myhome" and description as "My awesome local page" REMEMBER the iternal name is the important part of this mod so choose wisely or just name it myhome to keep it simple.
* Now you need a ftp client to go to your website root folder. I use filezilla it is free
* In your theme folder make a copy of your main.php and name it myhome.php
* then in your website root folder make copy of search.php and name is as myhome.php
****Now the real fun begins that took me a good whole night to work it out then
***
To understand how this works you need to know how osclass chain of commond works.
User come to your website
When the user click on any category say jobs link that is set up to look for search.php. The clicky goes to index.php where it is redirected to search.php on root and search.php convert that query into results show it the theme search.php page.
Now this mod is to change the regions and cities links to look for myhome.php.
When user select the city say mardan from the dropdown list on the main page the link goes to index.php where it is redirected to myhome.php on root and then the required result i.e. a function in myhome.php looks for city of mardan and its listing in database and return the results in myhome.php in your theme folder.
I hope I explained it clearly the whole process. lets make it happen now one by one.
First you need to add the myhome.php case to the index.php edit index.php to find the below and add the myhome case under it.
case ('search'): // search pages
require_once(osc_base_path() . 'search.php') ;
$do = new CWebSearch() ;
$do->doModel() ;
break;
case ('myhome'): //myhome
require_once(osc_base_path() . 'myhome.php') ;
//osc_lib_path() in new version see below $do = new CWebMyhome() ;
$do->doModel() ;
break;
Now lets go to myhome.php on root and we need to edit it to change all mSearch references to mMyhome (be careful its mMyhome)on line 20 change CWebSearch to CWebMyhome [as above set in index.php] then use you find and replace function in ftp client to change all mSearch to mMyhome.
Then on line 33 and 381 replace the word search to myhome.
That done now save and upload and close this page.
Next open main.php inside your theme folder we need to change the locations link in the sidebar to myhome instead of going to search page.To show Regions and Cities with ads using the following code [NoTICE the link url added that redirct it to myhome.php] <div class="navigation">
<?php if(osc_count_list_regions() > 0 ) { ?>
<div class="box location">
<h3><strong><?php _e("Regions", 'modern') ; ?></strong></h3>
<ul>
<?php while(osc_has_list_regions() ) { ?>
<li><a href="../index.php?page=myhome&sRegion=<?php echo osc_list_region_name(); ?>"><?php echo osc_list_region_name() ; ?></a> <em>(<?php echo osc_list_region_items() ; ?>)</em></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php if(osc_count_list_cities() > 0 ) { ?>
<div class="box location">
<h3><strong><?php _e("Cities", 'modern') ; ?></strong></h3>
<ul>
<?php while(osc_has_list_cities() ) { ?>
<li><a href="../index.php?page=myhome&sCity=<?php echo osc_list_city_name(); ?>"><?php echo osc_list_city_name() ; ?></a> <em>(<?php echo osc_list_city_items() ; ?>)</em></li>
<?php } ?>
</ul>
</div>
<?php } ?>
</div>
Save upload and close main.php now.
Next open myhome.php in theme folder and replace location div as above in the sidebar aswell.NOW let add some code as below somewhere on the top just above <div class="content home"> that would tell the user which region or city they are viewing... <div>
<span>Your are in....<a href="../index.php?page=myhome&sCity=<?php echo osc_search_city() ; ?>"><?php echo osc_search_city() ; ?></a><a href="../index.php?page=myhome&sRegion=<?php echo osc_search_region() ; ?>"><?php echo osc_search_region() ; ?></a></span>
</div>
Save and upload. click on any region in your site and you should see the message.. Pretty cool huh...
you are nearly there...
Again In this myhome.php we to do a bit of work to change the categories links to be changed to myhome results i.e. when there user is viewing Mardan city and them click on JOBS category they will be only shown the adverts from Mardan. lets do it.
For Categories your code show look like below [Notice the url link added] you can also use the same url for your Top menu categories if you have any eg in twitter/becute themes<div class="category">
<h1><strong><a class="category cat_<?php echo osc_category_id() ; ?>" href="
../index.php?page=myhome&sCity=<?php echo osc_search_city();?>&sRegion=<?php echo osc_search_region();?>&sCategory[]=<?php echo osc_category_id() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></strong></h1>
<?php if ( osc_count_subcategories() > 0 ) { ?>
<ul>
<?php while ( osc_has_subcategories() ) { ?>
<li><a class="category cat_<?php echo osc_category_id() ; ?>" href="
../index.php?page=myhome&sCity=<?php echo osc_search_city();?>&sRegion=<?php echo osc_search_region();?>&sCategory[]=<?php echo osc_category_id() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></li>
<?php } ?>
</ul>
<?php } ?>
</div>
Next to show latest advert in the selected City or Regionin myhome.php above find the latest_ads div and insert the under it as code below
<div class="latest_ads">
<h5><?php if(osc_search_total_items()>0){ echo ' ('.osc_search_total_items().')';}?><?php _e(' Adverts in ', 'modern') ; ?><?php echo osc_search_city() ; ?><?php echo osc_search_region() ; ?></h5>
<?php osc_current_web_theme_path('search_list.php') ; ?>
Change the Search Box from categories to Regions with adverts that will return that region page with search resultsIn your theme folder open
inc-search.phpand modify the FORM code as below [NOTICE value = "myhome"]
You Must not use the category search box as it will not return the region and all other link will become useless<form action="<?php echo osc_base_url(true) ; ?>" method="get" class="search" onsubmit="javascript:return doSearch();">
<input type="hidden" name="page" value="myhome" />
<fieldset class="main">
<input type="text" name="sPattern" id="query" value="<?php echo osc_esc_html( ( osc_search_pattern() != '' ) ? osc_search_pattern() : $sQuery ); ?>" />
<select>
<?php View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions('%%%%', '>=', 'region_name ASC') ) ; ?> <?php if(osc_count_list_regions()>0) {?>
<?php while(osc_has_list_regions()) { ?>
<option value="<?php echo osc_list_region_name();?>"><?php echo osc_list_region_name();?><em><?php if(osc_list_region_items()>0){ echo ' ('.osc_list_region_items().')';}?></em></option>
<?php } ?>
<?php } ?>
</select>
<button type="submit"><?php _e('Search', 'modern') ; ?></button>
</fieldset>
<div id="search-example"></div>
</form>
finally replace the SEE MORE div code to as below {notice the link added to it]<p class="see_more_link"><a href="../index.php?page=search&sCity=<?php echo osc_search_city(); ?>&sRegion=<?php echo osc_search_region(); ?>"><strong><?php _e("See all offers", 'modern'); ?> »</strong></a></p>
Thats it that is how you do it.
If you like this mod and want to thank me you can buy me coffe via paypal.
computerbar@gmail.com See demo on
http://singer.pk &
http://jamal.pkUPDATE:The above instructions are for older Osclass versions.
If you are using new version of OSCLASS read below.
The
search.php has been shifted to
/oc-includes/osclass/controllerIf you have updated to new versionYou need to move the myhome.php to that folder from root after the update
and
Edit/update
index.php with following
case ('myhome'): //myhome
require_once(osc_lib_path() . '
osclass/controller/myhome.php') ;
$do = new CWebMylocal() ;
$do->doModel() ;
break;
If new user with new version of OSCLASS where the Search.php is not on ROOT but in controller folder
1) Edit Index.php
2) Make a copy of Search.php in controller folder and name it myhome.php and edit it as above.
3) Create new new page name it as myhome
4) Make a copy of your main.php in theme folder and name it myhome.php and edit catgories/city/region links as above.
DONE