Keywords: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Album keyword filter autocomplete== *AJAX handler /_ajax/images/album_title_search.php *Define derived version of <code>search_titles()</code> the default <code>album_filter...") |
|||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== | ==Overview== | ||
* | |||
*Define | 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=== | |||
* LITTLED/JQuery config within <code>$(document).ready()</code> | |||
:<syntaxhighlight lang="javascript"> | |||
$fn.keywords('bindListingsHandlers'); | |||
</syntaxhighlight> | |||
:* This is ''not'' rolled into <code>$fn.listings('bindListingsHandlers')</code> | |||
:* Typically, it would be added to a JQuery plugin targeted to a specific CMS content section: | |||
<syntaxhighlight lang="javascript" highlight="14,19"> | |||
/* | |||
* file: content_type.js | |||
* JQuery added functionality | |||
*/ | |||
(function($) { | |||
var methods = { | |||
bindListingsHandlers: function() { | |||
return this.each(function() { | |||
/* listings handlers */ | |||
$(this) | |||
.listings('bindListingsHandlers') | |||
.keywords('bindListingsHandlers'); | |||
LITTLED.init({setSortables: function() { | |||
$('#listings-container') | |||
.listings('bindListingsButtons') | |||
.keywords('bindListingsButtons'); | |||
}}); | |||
}); | |||
}, | |||
/* etc... */ | |||
</syntaxhighlight> | |||
* 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=== | |||
====JQuery handlers==== | |||
LITTLED/JQuery config within <code>$(document).ready()</code> | |||
<syntaxhighlight lang="javascript"> | |||
$fn.keywords('bindListingsHandlers'); | |||
</syntaxhighlight> | |||
====Inserting the keyword markup with PHP==== | |||
On the details page, assuming that the content object is derived from <code>db_keyword_content_class</code> | |||
<syntaxhighlight lang="php"> | |||
<div class="metadata"> | |||
<? | |||
$keywords = &$input; | |||
include (COMMON_TEMPLATE_DIR."content/keywords/keywords_cell.php"); | |||
?> | |||
</div> | |||
</syntaxhighlight> | |||
====AJAX handler==== | |||
* Default handler: <code>_ajax/utils/edit_keywords.php</code> | |||
** Assumes that a case for the content type has been created in the PHP routine <code>cache_class::update_keywords()</code> | |||
** If the content type caches the keywords for fulltext search, then the PHP class for the content type must define a routine named <code>update_fulltext_keywords()</code>. | |||
* Keyword records are saved in PHP routine <code>db_keyword_content_class::save_keywords()</code> | |||
== Album keyword filter autocomplete == | |||
* See [[JQuery_Initialization_on_Listings_Pages#Keyword_filter_autocomplete|Keyword filter autocomplete]] | |||
[[Category:CMS_Documentation]] | [[Category:CMS_Documentation]] | ||
Latest revision as of 00:40, 21 December 2012
Overview[edit]
Details about implementing keywords with PHP classes.
PHP libraries[edit]
[COMMON_LIB]_classes/db/db_keyword_content_class.php[COMMON_LIB]_classes/keywords/keyword_class.php
Displaying keywords[edit]
Displaying keyword lists within listings pages[edit]
- LITTLED/JQuery config within
$(document).ready()
$fn.keywords('bindListingsHandlers');- This is not rolled into
$fn.listings('bindListingsHandlers') - Typically, it would be added to a JQuery plugin targeted to a specific CMS content section:
- This is not rolled into
/*
* file: content_type.js
* JQuery added functionality
*/
(function($) {
var methods = {
bindListingsHandlers: function() {
return this.each(function() {
/* listings handlers */
$(this)
.listings('bindListingsHandlers')
.keywords('bindListingsHandlers');
LITTLED.init({setSortables: function() {
$('#listings-container')
.listings('bindListingsButtons')
.keywords('bindListingsButtons');
}});
});
},
/* etc... */
- 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[edit]
JQuery handlers[edit]
LITTLED/JQuery config within $(document).ready()
$fn.keywords('bindListingsHandlers');
Inserting the keyword markup with PHP[edit]
On the details page, assuming that the content object is derived from db_keyword_content_class
<div class="metadata"> <? $keywords = &$input; include (COMMON_TEMPLATE_DIR."content/keywords/keywords_cell.php"); ?> </div>
AJAX handler[edit]
- Default handler:
_ajax/utils/edit_keywords.php- Assumes that a case for the content type has been created in the PHP routine
cache_class::update_keywords() - If the content type caches the keywords for fulltext search, then the PHP class for the content type must define a routine named
update_fulltext_keywords().
- Assumes that a case for the content type has been created in the PHP routine
- Keyword records are saved in PHP routine
db_keyword_content_class::save_keywords()