3/5/2011
Custom Tags
One area that had always been tricky in zestoi, was how to easily define what should be displayed for the title or meta tags etc on each/any page. This has now been solved by the addition of Custom Tags.
In each edit page (articles, dating, videos, webcams) you will now see at the bottom of the page a Custom Tags table with 3 colums. The Single column is used when a single article or webcam profile etc is displayed while the Multiple one for a blog feed or grid of videos etc.
You can define any named tags. To solve the title issue a sensible named tag might be page_title which you would then define in each of the modules settings pages.
Variables from the URL and from decoded content can be used via smarty style tags like {$name}. If the current page doesn't contain that variable then it will be removed so it is safe to define something like this for videos multiple:
{$site}{$category}{$tags} Videos
Separate options may be delimitted with a pipe | character and then one is chosen at random and will remain at that choice for every subsequent page load.
Examples
For example these could be used to define page_title for each type:
- Article
- Single {$title}
- Multi {$channel} channel
- Dating
- Single {$name} from {$city}, {$country}|{$name}
- Multi dating {$country}{$city}{$site}
- Videos
- Single {$title} {$tags} {$category} {$mode}
- Multi {$tags} {$category} {$mode} videos
- Webcams
- Single {$name} model from {$site}|sexy {$age} year old {$name} camgirl
- Multi {$niche}{$site} webcams|sexy {$niche}{$site} cams
To use this new variable in your templates you would use:
- Smarty: {$page_title}
- PHP: zestoi_val('page_title')
- PCT: %%page_title%% or %%PAGE_TITLE%%
Capitalization
The custom tags do not support full Smarty syntax - only basic variable substitution, but also has a method for capitalization by simply capitalizing the variable. e.g: for the "all-online" webcams niche:
- {$niche} results in "all online"
- {$Niche} results in "All Online"
- {$NICHE} results in "ALL ONLINE"
Functions
Two new functions have been added, though will only need to be called explicitely in rare circumstances:
- zestoi_expand_customtags() which sets any custom tags you have defined based on the current URL and decoded data. Automatically called unless you are using a custom page where you have set the URL type to be "none".
- zestoi_get_customtags() which returns (or sets to a variable if you use the Smarty equivalelent of {customtags var=myvar}) an array() of all the custom tags you have defined via the web interface.
Articles/RSS Feeds
To move the articles more inline with the rest of the plugins the following changes have been made:
- The urlconfig types of feed and article have been replaced by the single articles type. There is no need to update your urlconfig, the new code is triggered from the old types.
- The old menu options under Settings > RSS Feeder have been moved to Settings > Articles
- New menu options Settings > Articles > Edit Settings that contains options for
- Default Feed Template (the old feed type)
- Default Article Template (the old article type)
- Max Articles - to display in a page
- Use UL Tags - to use UL/LI tags etc in a list of articles. default is to not wrap these tags.
- New cron: php cron.php -m articles to process the rssfeeds (and more article related things in the future). The rssimporter can still be run via php cron.php -m rssfeeder if needed
- Extra option Publish Immediately available for each RSS feed to allow items to be added but not published. They can then be manually editted and/or published via the article editor or published via the zestoi.php CLI.
- The new Custom Tags functionality can also be specified for each Channel via Settings > Articles > List Channels
- You can now delete a Channel and all articles in it from the new List Channels page.
Webcams
- The new Custom Tags functionality can also be specified for each individual webcams niche that you create. Edit any niche via Settings > Webcams > List Niches and clicking on a niche.
- A new option of max_models arg for the camworld feed to limit how many models are requested per cron run as with other feeds that support it.
- more intelligent algorithm for calculating number of online for niches
New Variable $URL
- Decoded args from the current page URL are no longer avaiable via {$channel} etc in a url like /blog/%channel%/%page% though {$page} is the one exception and still is
- If you want to access data from the URL you now need to explicitely use the new variable $URL like {$URL.args.channel}
- This is due to data like $channel previously overwriting data from the current blog item etc, where a blog item can have multiple channels
- You can still also access the content of $URL by the functions zestoi_decode_url() and {decode_url}
Query Args now Decoded from URL
- It was always ticky to easily paginate from a search page, so now the url args like ?hair_color=blonde are included as part of the decode for defining the content to be displayed
- This now means that this url config rule:
/category/%niche%/%page%
- Will match the following URL:
/category/girls/?age=18..22&hair_color=blonde
- Filtering the content to only display ages between 18 and 22 and hair color of blonde. For pagination the value of {$URL.page_nav_url} will be set to
/category/girls/%page%?age=18..22&hair_color=blonde
- Smarty {expand_url template=$URL.page_nav_url page=$pagenum}
- PHP zestoi_expand_url($URL['page_nav_url'], "page=$pagenum")
- PHP zestoi_expand_url($URL['page_nav_url'], array('page' => $pagenum))
Cron
- A new cron task has been added that optimizes all the zestoi database tables. Running this cron task every 24hrs should be enough.
- To run this cron use the command:
php cron.php -m optimize
- Click on Help in your admin panel to get the exact code for your crontab. It should look something like this, which will run the task at midnight each day.
0 0 * * * cd /path/to/zestoi/bin && php cron.php -m optimize
New URL Config Tester
Often in a complicated setup with many different plugins enabled (webcams, videos, dating, articles) it can be difficult to understand why the page you expected to load doesn't. To rectify this we have added a url config tester linked to from the main url config page Settings > URL Config.
It allows you to enter a URL from your main zestoi site and it will test against each rule you have defined and show you the content that will be decoded/displayed for that URL.
Example:
Testing URL: /category/girls/4
Checking Rule 1: blog_channel = /feed/%channel%/%page%
Checking Rule 2: webcams_niche = /category/%niche%/%page%
The URL Matches Rule 2! Zestoi will decode/display webcams for this page
Setting {$niche} to 'girls'
Setting {$page} to '4'
We have some extra-args for this Rule:
Setting {$status} = !offline
We have some query args to add:
Setting {$hair_color} = blonde
Config Export
From Settings > URL Config page you can now save all the settings so they can be reimported later on.
By default it will save to settings.txt in your current theme dir but can be changed to save anywhere under the themes directory.
The URL Config can be saved either in a format so that the new site loads exactly what you saved, or alternately in a format that will attempt to add/merge/update entries on the new site so you don't lose the order of the items and any extra entries when loaded.
You can also choose to save the settings for articles, dating, videos and webcams as well as youyr Custom Tags.
Misc
- New function zestoi_have_module('webcams') and the smarty {have_module name='webcams'} to allow new themes to be developed that contain content for all modules while still looking good with only the modules that a user has installed. The full list of modules (that affect web display directly) is now:
- articles
- dating
- videos
- webcams