Skip to content
jjeroennl edited this page Apr 20, 2015 · 2 revisions

The content system can be used for plugin's to create a custom type of content, for example a photoalbum or a blog. It can also be used for theme's to create very specific theme's. For example to create a app.

It also contains some of the basic functionality for theme's to display menu's and content.

Items with a * are required

###content_create_type

content_create_type($type, $additional_function, $menu, $menu_way);
  • $type*; String, The name of you content type.
  • $additional_function; String, A extra function to add at all the pages of your content type. See (Aditional functions)[#aditional_functions]
  • $menu; Integer, 1 means your content type gets a page, 0 means not
  • $menu_way; Integer, the way that your content type gets displayed in the navigation. 1 means you will get one menuitem which houses all of the content, this can be usefull for a blog. 2 means you will get a seperate menuitem for each item.

Example:

<?php
  $type = "Blog";
  $additional_function = "comments";
  $menu = 1;
  $way = 1;
  content_create_type($type, $additional_function, $menu, $menu_way);

  //this will create 1 page which contains all of the content.
?>

###content_get_type

content_get_type($name);
  • $name; String, the name of the contenttype

Example:

<?php
  $name = "blog";
  $num = content_get_type($name);
  //this will return the ID of the content type.
?>

###content_get_way

content_get_way($id);
  • $name; String, the name of the contenttype

Example:

<?php
  $name = "blog";
  $num = content_get_type($name);
  $way = content_get_way($num);
  //This will return the menu_way.
  //If the way is non-set it will return NULL;
?>

###content_search

content_search($searchterm);
  • $searchterm; String, the query you want to search.

Example:

<?php
  $searchterm = "Lorum";
  $result = content_search($searchterm);
  //Result is a array with the search-results
?>

###content_query

content_query($type, $way, $id);
  • $type*; String, the type you want to get. Use "00" for all.
  • $way; String, the way you want to get the content. Use static for a single item ($id becomes required if you choose this) or loop
  • $id; Integer, the id of the content you want to get.

This is used only for advanced plugins, if you want to get content for your theme it's higly recommended that you use content_get_page_title and content_get_content.

Example:

<?php
  $type = content_get_type("Blog");
  $way = "loop";
  $query = content_query($type, $way);

  while($row = db_grab){
    echo $row['title'];
    echo $row['content'];
  }
?>

###content_get_title

content_get_title($id);
  • $id; Integer, the ID of the content.

Example:

echo content_get_title($id);

###content_get_page_title

content_get_page_title();

This will get the page title of the current page. It uses the $_GET['p'] variable.

Example:

<?php
  echo content_get_page_title();
?>

###content_get_content

content_get_content();

This will get the content of the current page. It uses the $_GET['p'] variable.

Example:

<?php
  echo content_get_content();
?>

###content_add

content_add($title, $content, $author, $status, $type);
  • $title; String, the title of the new content
  • $content; String, the content of the new content
  • $author; Integer, the author of the new content
  • $status; Integer, the status of the content. 0 meaning not published and 1 meaning published.
  • $type; Integer, content type

Example:

<?php
  $title = "My new blog message";
  $content = "...";
  $author = 1;
  $status = 1;
  $type = content_get_type("Blog");

  content_add($title, $content, $author, $status, $type);
?>

###content_modify

content_modify($id, $content);
  • $id; Integer. The ID of the content
  • $content; String, the new content of the content

Example:

<?php
  $id = 1;
  $content = "...";

  content_modify($id, $content);
?>

###content_modify_info

content_modify_info($id, $info);
  • $id; Integer. The ID of the content
  • $content; Array array("status" => 0)

Example:

<?php
  $id = 1;
  $info = array(
    "status" => 1,
    "type" => 2
  );
?>

###content_delete

content_delete($id);
  • $id; Integer, the id of the content

Example:

<?php
  $id = 1;
  content_delete($id);
?>

###content_nav

content_nav();

This will spawn a navigation menu in this syntax:

<li><a href="URL">PAGENAME</a></li>
Clone this wiki locally