Keywords: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==Overview==
Details about implementing keywords with PHP classes.
==PHP libraries==
* <code>[COMMON_LIB]_classes/db/db_keyword_content_class.php</code>
* <code>[COMMON_LIB]_classes/keywords/keyword_class.php</code>
==Displaying keywords==
===Displaying keyword lists within listings pages===
* Outside the listings loop,
** Define an object to use to retrieve and display keyword lists.
** Set the keyword object's content id to the appropriate value for the listings content.
* Within the listings loop,
** Set the id of the keyword object to the current record id.
** Include shared content include to display keyword list.
** Clear keyword values.
<syntaxhighlight lang="php" highlight="1,7-9">
$keywords = new db_keyword_content_class($filters->site_section->id->value);
while ($row = mysql_fetch_object($rs)) {
?>
<tr class="rec-row <?=$rowClass?>" id="rr-<?$filters->site_section->id->value?>-<?=$row->id?>" data-rid="<?=$row->id?>">
<td>
<?
$keywords->id->value = $row->id;
include (COMMON_TEMPLATE_DIR."content/keywords/keywords_cell.php");
$keywords->clear_keyword_data();
?>
</td>
</tr>
}
</syntaxhighlight>
===Displaying keyword lists within 'details' pages===
* TK
==Album keyword filter autocomplete==
==Album keyword filter autocomplete==
*AJAX handler: <code>/_ajax/images/album_title_search.php</code>
*AJAX handler: <code>/_ajax/images/album_title_search.php</code>
*Define derived version of <code>search_titles()</code>. The base routine <code>album_filters_class->search_titles()</code> routine won’t work with the table structure.
*Define derived version of <code>search_titles()</code>. The base routine <code>album_filters_class->search_titles()</code> routine won’t work with the table structure.
[[Category:CMS_Documentation]]
[[Category:CMS_Documentation]]

Revision as of 14:24, 12 May 2012

Overview

Details about implementing keywords with PHP classes.

PHP libraries

  • [COMMON_LIB]_classes/db/db_keyword_content_class.php
  • [COMMON_LIB]_classes/keywords/keyword_class.php

Displaying keywords

Displaying keyword lists within listings pages

  • Outside the listings loop,
    • Define an object to use to retrieve and display keyword lists.
    • Set the keyword object's content id to the appropriate value for the listings content.
  • Within the listings loop,
    • Set the id of the keyword object to the current record id.
    • Include shared content include to display keyword list.
    • Clear keyword values.
$keywords = new db_keyword_content_class($filters->site_section->id->value);
while ($row = mysql_fetch_object($rs)) {
?>
	<tr class="rec-row <?=$rowClass?>" id="rr-<?$filters->site_section->id->value?>-<?=$row->id?>" data-rid="<?=$row->id?>">
		<td>
<?
	$keywords->id->value = $row->id;
	include (COMMON_TEMPLATE_DIR."content/keywords/keywords_cell.php");
	$keywords->clear_keyword_data();
?>
		</td>
	</tr>
}

Displaying keyword lists within 'details' pages

  • TK

Album keyword filter autocomplete

  • AJAX handler: /_ajax/images/album_title_search.php
  • Define derived version of search_titles(). The base routine album_filters_class->search_titles() routine won’t work with the table structure.