Displaying Models from a specific site and niche

From Adult Web Scripts Wiki

Jump to: navigation, search

The aim here is to make pages webcam sponsor/site centric and display a list of niches in the sidebar which when clicked only display models from the current webcam site as well as the chosen niche

Contents

Create a new URL Config rule

Create a rule that doesn't conflict with any current ones. We are going to add this to the bottom:

 name: webcams_siteniche
 rule: /sponsor/%site%/%niche%/%page%
 type: webcams

Test the New Rule

Go to the url config tester from the url config page and enter a test url that you expect to match, e.g:

 /sponsor/livejasmin/girls/2

This url works for my config and it reports the following:

 The URL Matches Rule 23! Zestoi will decode/display webcams for this page
 Setting {$site} to 'livejasmin'
 Setting {$niche} to 'girls'
 Setting {$page} to '2'

At the bottom you will see what variables are available for this page. In my case it says (for smarty)

  {$URL.urlconfig_name} = 'webcams_siteniche'
  {$URL.type} = 'webcams'
  {$URL.page_nav_url} = '/sponsor/livejasmin/girls/%page%'
  {$URL.args.site} = 'livejasmin'
  {$URL.args.niche} = 'girls'
  {$URL.args.page} = '2'

Create a new Template

We only want to display the links to site+niche when we are already sponsor centric so copy your webcams index template to webcams_siteniche.tpl (or php) to ensure we can modify this specific case:

 cd zestoi/themes/tpc-red-devil
 cp webcams_index.tpl webcams_siteniche.tpl

In this theme (tpc-red-devil) the index file loads a separate sidebar template so we need to copy webcams_left_sidebar.tpl to webcams_left_sidebar_siteniche.tpl and edit webcams_siteniche.tpl to include this new sidebar with:

{include file="webcams_left_sidebar_siteniche.tpl}

Edit the Sidebar Template

We can get the current webcam site from $URL.args.site (see step 2 above) so we just need to edit the loop that lists the webcam niches.

We need to edit webcams_left_sidebar_siteniche.tpl from this:

{foreach from=$wcniches item=niche}
<li><a href="{url_encode urlconfig_name=webcams_niche niche=$niche.url_name}">
{$niche.name}</a>
<span class="webcam-counts">({$niche.online}/{$niche.total})</span></li>
{/foreach}

To this:

{foreach from=$wcniches item=niche}
<li><a href="{url_encode urlconfig_name=webcams_siteniche niche=$niche.url_name site=$URL.args.site}">
{$niche.name}</a>
</li>
{/foreach}

We had to remove the webcam counts as they are for all webcam sites.

If Older than Zestoi 1.3.1

If using older than Zestoi 1.3.1 then you will additionally need to manually grab $URL at the top of your webcams_sideniche.tpl by adding this as the first line:

{decode_url var=URL}

Test

We can now go to a page like this:

 http://www.mydomain.com/sponsor/livejasmin/girls/

and see models from that specific site and niche as well as the correct links in the left hand sidemenu.