Templates

  1. Intro

  2. Commands list

  3. Request

  4. Thumb object properties list

  5. Preview object properties

  6. Custom error pages

  7. Search

Intro

Templates defines disign of your site. INXY templates are *.php files with special instructions. If you are fimilar with HTML you can take standart templates and edit HTML to get site ready for use. Its important to leave unchanged instuctions between <? ?> tags.

Templates located in templates directory. Threre are three types of templates layouts, site and sub.

Templates interaction scheme

Commands list

Optional params - [], Template type - (). L - layout, ะก -content template, S - subtemplate

<?=Inxy::action()?> (LCS)
Outputs name of current content template (action)
<?=Inxy::category()?> (LCS)
Outputs name of current category
<?=Inxy::categoriesByCtr(['categories_by_ctr'[, 300]])?> (LC)
Outputs list of categories ordered by CTR using categories_by_ctr.php subtemplate
<?=Inxy::categoriesByLastClicks(['categories_by_last_clicks'[, 300]])?> (LC)
Outputs list of categories ordered by last clicks using categories_by_last_clicks.php subtemplate
<?=Inxy::categoriesByName(['categories_by_name'[, 300]])?> (LC)
Outputs list of categories ordered by name using categories_by_name.php subtemplate
<?=Inxy::description()?> (LC)
Outputs site description for pages with tumbs or gallery description at gallery page
<?=Inxy::ifActionMatch(val, [true 'highlight'[, false 'default']])?> (LC)
Retunrs true if current action matches with val overwise returns false. Use it to set diffrent CSS styles for active and not active items of menu
<?=Inxy::ifAllMatch([true 'highlight'[, false 'default']])?> (LC)
Retunrs true if current group matches with All overwise returns false. Use it to set diffrent CSS styles for active and not active items of menu.
<?=Inxy::ifCategoryMatch(val, [true 'highlight'[, false 'default']])?> (LC)
Retunrs true if current category matches with val overwise returns false. Use it to set diffrent CSS styles for active and not active items of menu.
<?=Inxy::ifMovMatch([true 'highlight'[, false 'default']])?> (LC)
Retunrs true if current group matches with Pic overwise returns false. Use it to set diffrent CSS styles for active and not active items of menu.
<?=Inxy::ifPicMatch([true 'highlight'[, false 'default']])?> (LC)
Retunrs true if current group matches with Pic overwise returns false. Use it to set diffrent CSS styles for active and not active items of menu.
<?=Inxy::ifTagMatch(val, [true 'highlight'[, false 'default']])?> (LC)
Retunrs true if current tag name matches with val overwise returns false. Use it to set diffrent CSS styles for active and not active items of menu.
<?=Inxy::isAll() ?> (LC)
Returns true if current group name is All, false overwise.
<?=Inxy::isMov() ?> (LC)
Returns true if current group name is Mov, false overwise.
<?=Inxy::isPic() ?> (LC)
Returns true if current group name is Pic, false overwise.
<?=Inxy::join(itemstemplateseparator?> (LC)
Joins array of items using subtemplate with name template and separator.
<?=Inxy::keywords()?> (L)
Outpust autogenerated keywords
<?=Inxy::name()?> (L)
Outpusts site name form settings
<?Inxy::orderByCtr()?> (C)
Set CTR thumbs order
<?Inxy::orderByDater()?> (C)
Sets date thumbs order
<?=Inxy::paginator()?> (C)
Outputs paginator
<?Inxy::setLayout(name)?> (C)
Sets layout name for use
<?Inxy::setThumbSub(name [, use_prefix false])?> (C)
Sets subtemplate for thumbs
<?=Inxy::tag()?> (LC)
Outputs current tag
<?=Inxy::tagsByName(offsetlimittemplate)?> (LC)
Uses template subtemplate for output tags ordered by name. Starts from offset and outpust maximum limit number of tags
<?=Inxy::tagsByWeight(offsetlimittemplate)?> (LC)
Uses template subtemplate for output tags ordered by weight. Starts from offset and outpust maximum limit number of tags
<?=Inxy::title()?> (L)
When page with thumbs then outputs site title when gallery page outputs gallery title when category page and category title is set then outputs category title
<?=Inxy::test([count 1])?> (C)
Outputs count of test thumbs
<?=Inxy::thumb([count 1])?> (C)
Outputs count of thumbs
<?=Inxy::total()?> (L)
Outputs number of galleries
<?=Inxy::totalNew()?> (L)
Outputs number of galleries created in last 24 hours
<?=Inxy::tplUrl()?> (LCS)
Relative url to directory with templates
<?=Inxy::url(template)?> (LCS)
Outputs url for action
<?=Inxy::virtual()?> (L)
Replacement for php virtual function name which is incompatible with INXY

Request

Using request you can detect and output current user's location

Example:

Thumb object properties list

[] - optional params

<?=$thumb->categories?>
Array of categories names
<?=$thumb->click_url?>
Click url (using trade script)
<?=$thumb->description?>
Gallery description
<?=$thumb->gallery_url?>
Direct link to gallery
<?=$thumb->height?>
Image width
<?=$thumb->img_url?>
Image height
<?=$thumb->publish_dt?>
Publish date
<?=$thumb->title?>
Gallery title

Preview object properties

[] - optional params

<?=$thumb->url?>
Link to image generated by INXY-scripts
<?=$thumb->src_url?>
Link to original image
<?=$thumb->media?>
Link to media object

Custom error pages

Since version 1.06 you can create custom error pages for http errors raised by script (404, 502 etc)

To create custom error page:

  1. Create layouts/error.php layout
  2. Create system/error.php template

Layout is similar to any other layout you have, but some function unavailable (Inxy::title(), Inxy::description(), Inxy::paginator()).

Template example:


<?php $messages = array(

    
404 => "Page not found",
    
503 => "Server busy",

)
?>
<h1><?=$e->status?></h1> 
<p><?=isset($messages[$e->status]) ? $messages[$e->status] : "Unknown error"?></p>

Search

WARNING THIS IS IS AN EXPERIMENTAL EXTENSION!

Using sphinx you can easy add search to you Iinxy site.

  1. Create sphinx source
    source domain_name
    {
    	type		= mysql
    	sql_host	= localhost
    	sql_user	= your_inxy_db_user	
    	sql_pass	= your_inxy_db_pass
    	sql_db		= your_inxy_db
    
    	sql_query				= \
    		SELECT rt.rotation_id, title, categories, tags, description, rt.content_type_id \
    		FROM gals g JOIN rotation rt ON rt.gal_id = g.gal_id WHERE g.status_id = 3 AND g.disabled_sum = 0 AND rt.category_id IN (1,2,3)
     	  
    	sql_attr_uint = content_type_id
    
    	sql_query_info	= SELECT * FROM rotation WHERE rotation_id=$id
    }
    
  2. Create sphinx index
  3. Create config inxy/var/config/sphinx.php. Example:
    
    
    <?
    return array(
      
    "host" => "localhost",
      
    "port" => 3312,
      
    "index" => "sphinx_index_name"
    );
    ?>
  4. Add to cron command to update you index
  5. Add to your template this code
    
    
    <form action="/">
    <input type="text" name="q">
    <input class="submit" type="submit"  value="Find" />
    </form>
  6. Create template site/search.php, use <?=Inxy::req()->search?> to output search request