HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Search engine optimisation

» Return to Contents



sources/seo2.php

Global_functions_seo2.php

Function summary

void seo_meta_erase_storage (ID_TEXT type, ID_TEXT id)
tempcode seo_get_fields (ID_TEXT type, ?ID_TEXT id)
void seo_meta_set_for_explicit (ID_TEXT type, ID_TEXT id, SHORT_TEXT keywords, SHORT_TEXT description)
SHORT_TEXT seo_meta_set_for_implicit (ID_TEXT type, ID_TEXT id, array keyword_sources, SHORT_TEXT description)

void seo_meta_erase_storage(ID_TEXT type, ID_TEXT id)

Erase a seo entry… as these shouldn't be left hanging around once content is deleted.

Parameters…

Name type
Description The type of resource (e.g. download)
Type ID_TEXT

Name id
Description The ID of the resource
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

tempcode seo_get_fields(ID_TEXT type, ?ID_TEXT id)

Get template fields to insert into a form page, for manipulation of seo fields.

Parameters…

Name type
Description The type of resource (e.g. download)
Type ID_TEXT

Name id
Description The ID of the resource (NULL: adding)
Default value
Type ?ID_TEXT

Returns…

Description Form page tempcode fragment
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void seo_meta_set_for_explicit(ID_TEXT type, ID_TEXT id, SHORT_TEXT keywords, SHORT_TEXT description)

Explictly sets the meta information for the specified resource.

Parameters…

Name type
Description The type of resource (e.g. download)
Type ID_TEXT

Name id
Description The ID of the resource
Type ID_TEXT

Name keywords
Description The keywords to use
Type SHORT_TEXT

Name description
Description The description to use
Type SHORT_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

SHORT_TEXT seo_meta_set_for_implicit(ID_TEXT type, ID_TEXT id, array keyword_sources, SHORT_TEXT description)

Sets the meta information for the specified resource, by auto-summarisation from the given parameters.

Parameters…

Name type
Description The type of resource (e.g. download)
Type ID_TEXT

Name id
Description The ID of the resource
Type ID_TEXT

Name keyword_sources
Description Array of content strings to summarise from
Type array

Name description
Description The description to use
Type SHORT_TEXT

Returns…

Description Keyword string generated (it's also saved in the DB, so usually you won't want to collect this)
Type SHORT_TEXT

Return to the function index for this class Expand: View the source code to this function

To apply SEO to a module, the following is roughly required for different sections of that modules code. This example is for the download system.

Add (actualisation):

Code (php)

   seo_meta_set_for_implicit('downloads_download',strval($id),array($name,$description,$comments),$description);
 
Edit (interface):

Code (php)

   $fields->attach(seo_get_fields('downloads_download',strval($id)));
 
Edit (actualisation):

Code (php)

   ,post_param('meta_keywords'),post_param('meta_description')
   ,$meta_keywords,$meta_description
   seo_meta_set_for_explicit('downloads_download',strval($id),$meta_keywords,$meta_description);
 
Delete:

Code (php)

   seo_meta_erase_storage('downloads_download',$id);
 
View:

Code (php)

   seo_meta_load_for('downloads_download',strval($id),$title_to_use);