Installing Articulate Articles is very simple with the built in installer file. The basic steps taken are: creating a database, editing a couple settings, CHMODing a file, and running the installer. Okay, it's not that bad! Let's get started...
Once you've downloaded Articulate Articles, the first thing you're going to want to do is create a MySQL database. If you don't know how to do this, Tutorialtastic does a great job explaining. Your next step is going to be to edit the settings on lines 6-13 in config.php. A sample of what the values might be are listed below.
$dbinfo = array(
'database' => 'blog',
'username' => 'root',
'password' => 'cupcakes394',
'host' => 'localhost'
);
$tablePrefix = 'aa_';
define('SECRET', 'IeNj0yt0sQu33zeflUFfym0nk1e$');
Please note that this is not the login information for the CMS, it's the login for the database; also, you will never have to remember "SECRET". You can now close config.php and upload the Articulate Articles directory to your server, renaming it to anything you want. Whatever you make the path, that's the place where your blog will show up. So if you wanted it as the root of the site, you would just copy the files inside the Articulate Articles directory to your home directory (usually either /public_html/ or /www/).
If you're planning on using the uploader, you'll need to CHMOD the uploads directory to 777.
There is one more step before you are able to run the installer. You will need to CHMOD the .htaccess to 666. You need to do this so that when you change to and from pretty permalinks the .htaccess file is automatically updated. You can now direct your browser to http://website.com/install_directory/admin/install.php — replacing website.com with your domain and install_directory with the directory you installed Articulate Articles in — and complete the options in the installer, and setup the default user/author. If, after you login, you receive an error telling you to delete the install file. Please do so, it's best to not keep it around if you don't need it.
There you have it. I told you it would be quick and painless. Now, go play with your new CMS. Don't forget to check back at this page for help with the templates.
If you aren't running the current version of Articulate Articles, you can simply point your browser to http://website.com/install_directory/admin/upgrade.php. You should be redirected to the dashboard; at this time you can delete upgrade.php and install.php from your server if you see an error.
Don't forget to follow all the other instructions to install! Like CHMODing the files and editing your settings.
Each post variable (usually $post) is an instance of the post class located in includes/class.post.php. Below are the properties and method of this class. They can be accessed the following ways: $post->property_name and $post->method_name().
get_id() · the_id()
These two methods are global along every post/page/category/comment/user/upload instance. They all return the id or display the id, depending on which method you called.
css($echo = true)
Returns or echoes, if $echo is true, CSS rules for the div. The CSS is something along the lines of: id="post-POST_ID" class="post".
get_author_object()
Returns the object of the author for that post. Read more about authors/users to get an idea of what this function can do for you.
get_comment_amount($word = 'Comment')
Returns the number of comments on that entry that have been approved and appends $word to the end of it with the correct ending. If there is zero or more than one comments, $word is changed to its plural form.
get_comment_status()
Returns a boolean value of either turn or false. This function is usually used when you're testing to see if comments are open.
if ($post->get_comment_status()) { //comments are open }
else { //comments are closed }
get_content($format = true) · the_content($format = true)
Both of these methods do the same thing, but get_content only returns the content, while the_content echoes it out. If $format is set to true, $post->content is auto paragraphed and abbreviation tags are added.
get_custom_field($key = '')
Returns the value of a specific custom field that was set in the admin panel. If the value doesn't exist or $key is left blank, false is returned.
get_date($format = 'F j, Y @ g:ia') · the_date($format = 'F j, Y @ g:ia')
Format $post->date according to the $format variable. More information on date formats can be found in the PHP manual.
get_excerpt($format = true, $forced = true) · the_excerpt($format = true, $forced = true)
If $forced is set to true and $post->excerpt is empty, a excerpt is made from the post's content. It is then formatted if $format is set to true.
get_mini_permalink()
Returns the "mini permalink" of that post. It will either be http://website.com/install_directory/?id=POST_ID or http://website.com/install_directory/id/POST_ID/ depending on what you set for the pretty permalinks option.
get_permalink($format = true, $options = array()) · the_permalink($format = true, $options = array())
Returns or echoes (depending on which function is called) the permalink to the post. It will either be http://website.com/install_directory/?entry=POST_SLUG or http://website.com/install_directory/entry/POST_SLUG/ depending on the pretty permalinks option.
If $format is set to false, just the permalink URL is returned. Otherwise, it is formatted into an anchor tag with $options being used as the attributes. You call this method in the following way.
$post->the_permalink(true, array( 'title' => 'Title for the link', 'text' => 'Text for the link', 'class' => 'classes applied for the link' ));
get_slug() · the_slug()
Returns/echoes out the post's slug. This is used with the get_permalink/the_permalink methods.
get_status()
Returns a boolean value if the post is either published (true) or a draft (false).
get_title()/the_title()
Returns/echoes out the post's title. The title is also run through htmlspecialchars before so that it can be safely used in link titles.
the_author($options = array())
Displays a link to the author's page using the the_permalink method found in the user object.
the_categories($glue = ', ', $echo = true)
Displays each category in a string that is separated by $glue. Each of the categories is formatted into a link using the the_permalink method found in the category class. If $echo is set to true, this new string is echoed otherwise it's returned.
the_comment_link($format = true, $options = array(), $echo = true)
Grabs the permalink of the current post and appends #comments to the end of it. It will then return this string as is if $format is set to false. If $format is set to true, it is turned into an anchor tag using the $options array as the attributes. It works much in the same way as the the_permalink method does.
Then, if $echo is set to true, this URL or anchor tag is displayed, otherwise the method returns it.
Each page variable (usually $page) is an instance of the page class located in includes/class.page.php. Below are the properties and method of this class. They can be accessed the following ways: $page->property_name and $page->method_name().
get_id() · the_id()
These two methods are global along every post/page/category/comment/user/upload instance. They all return the id or display the id, depending on which method you called.
get_content($format = true) · the_content($format = true)
Both of these methods do the same thing, but get_content only returns the content, while the_content echoes it out. If $format is set to true, $page->content is auto paragraphed and abbreviation tags are added.
get_custom_field($key = '')
Returns the value of a specific custom field that was set in the admin panel. If the value doesn't exist or $key is left blank, false is returned.
get_date($format = 'F j, Y @ g:ia') · the_date($format = 'F j, Y @ g:ia')
Format $page->date according to the $format variable. More information on date formats can be found in the PHP manual.
get_permalink($format = true, $options = array()) · the_permalink($format = true, $options = array())
Returns or echoes (depending on which function is called) the permalink to the page. It will either be http://website.com/install_directory/?p=PAGE_SLUG or http://website.com/install_directory/p/PAGE_SLUG/ depending on the pretty permalinks option.
If $format is set to false, just the permalink URL is returned. Otherwise, it is formatted into an anchor tag with $options being used as the attributes. You call this method in the following way.
$page->the_permalink(true, array( 'title' => 'Title for the link', 'text' => 'Text for the link', 'class' => 'classes applied for the link' ));
get_slug() · the_slug()
Returns/echoes out the page's slug. This is used with the get_permalink/the_permalink methods.
get_status()
Returns a boolean value if the page is either published (true) or a draft (false).
Each category variable (usually $category) is an instance of the category class located in includes/class.category.php. Below are the properties and method of this class. They can be accessed the following ways: $category->property_name and $category->method_name().
get_id() · the_id()
These two methods are global along every post/page/category/comment/user/upload instance. They all return the id or display the id, depending on which method you called.
get_description($format = true) · the_description($format = true)
Both of these methods do the same thing, but get_description only returns the description, while the_description echoes it out. If $format is set to true, $category->description is auto paragraphed and abbreviation tags are added.
get_name() · the_name()
Returns/echoes out the category's name.
get_permalink($format = true, $options = array()) · the_permalink($format = true, $options = array())
Returns or echoes (depending on which function is called) the permalink to the category. It will either be http://website.com/install_directory/?category=CATEGORY_SLUG or http://website.com/install_directory/category/CATEGORY_SLUG/ depending on the pretty permalinks option.
If $format is set to false, just the permalink URL is returned. Otherwise, it is formatted into an anchor tag with $options being used as the attributes. You call this method in the following way.
$category->the_permalink(true, array( 'title' => 'Title for the link', 'text' => 'Text for the link', 'class' => 'classes applied for the link' ));
get_post_amount()
Returns the number of posts that are categorized under that category.
get_slug() · the_slug()
Returns/echoes out the category's slug. This is used with the get_permalink/the_permalink methods.
Each user variable (usually $user or $author) is an instance of the user class located in includes/class.user.php. Below are the properties and method of this class. They can be accessed the following ways: $user->property_name and $user->method_name().
get_id() · the_id()
These two methods are global along every post/page/category/comment/user/upload instance. They all return the id or display the id, depending on which method you called.
get_email() · the_email()
Returns/echoes out the user's email.
get_nickname() · the_nickname()
Returns/echoes out the user's nickname. If the user didn't add one, an empty string is returned.
get_password()
Returns the user's encrypted password.
get_permalink($format = true, $options = array()) · the_permalink($format = true, $options = array())
Returns or echoes (depending on which function is called) the permalink to the user. It will either be http://website.com/install_directory/?user=USERNAME or http://website.com/install_directory/user/USERNAME/ depending on the pretty permalinks option.
If $format is set to false, just the permalink URL is returned. Otherwise, it is formatted into an anchor tag with $options being used as the attributes. You call this method in the following way.
$user->the_permalink(true, array( 'title' => 'Title for the link', 'text' => 'Text for the link', 'class' => 'classes applied for the link' ));
get_post_amount() · the_post_amount()
Returns/echoes out the number of published posts written by the user.
get_profile($format = true) · the_profile($format = true)
Both of these methods do the same thing, but get_profile only returns the profile, while the_profile echoes it out. If $format is set to true, $user->profile is auto paragraphed and abbreviation tags are added. An empty string is returned for no profile being entered when creating the user.
get_username() · the_username()
Returns/echoes out the user's username. Used with get_permalink.
get_website($format = true, $options = array()) · the_website($format = true, $options = array())
Returns or echoes (depending on which function is called) the user's website. An empty string is returned for no website being entered at creation.
If $format is set to false, just the website URL is returned. Otherwise, it is formatted into an anchor tag with $options being used as the attributes. You call this method in the following way.
$user->the_website(true, array( 'title' => 'Title for the link', 'text' => 'Text for the link', 'class' => 'classes applied for the link' ));
display_name($echo = true)
Returns/echoes out (if $echo is set to true) the user's nickname if not empty otherwise the username.
the_email_link($options = array(), $echo = true)
Returns or echoes (depending on if $echo is true) the user's email.
If $format is set to false, just the email address is returned. Otherwise, it is formatted into an anchor tag with $options being used as the attributes. You call this method in the following way.
$user->the_email_link(array( 'title' => 'Title for the link', 'text' => 'Text for the link', 'class' => 'classes applied for the link' ));
Each upload variable (usually $upload) is an instance of the upload class located in includes/class.upload.php. Below are the properties and method of this class. They can be accessed the following ways: $upload->property_name and $upload->method_name().
get_id() · the_id()
These two methods are global along every post/page/category/comment/user/upload instance. They all return the id or display the id, depending on which method you called.
get_date($format = 'F j, Y @ g:ia') · the_date($format = 'F j, Y @ g:ia')
Format $upload->date according to the $format variable. More information on date formats can be found in the PHP manual.
get_image($format = true, $options = array())
Returns or echoes (depending on if $echo is true) the image.
If $format is set to false, just the image address is returned. Otherwise, it is formatted into an image tag with $options being used as the attributes. You call this method in the following way.
$upload->the_image(array( 'alt' => 'Alternative text for the image', 'class' => 'classes applied for the link', 'link' => true, // wraps the image in a link to the image URL 'title' => 'Title for the link' ));
Settings are much more different than the other five tables. They are accessed through the get_option() function. You pass a single argument which is the setting's key, and are given back a value, nothing else.
Valid keys:
Besides the last two keys, you should be familiar with them because that's what you saw on the installation file. The RSS URL will be formatted as either http://wesbite.com/install_directory/feed.php or as http://website.com/install_directory/feed/ depending on the pretty permalinks setting.
SEO friendly URLs or what I like to call "pretty permalinks" is how the URLs are formatted. If this option is set to true (or "yes") there will be no query string in the URLs, aka no question marks. They look like it's directories in directories.
You simple call the get_option function and pass in one of the above keys:
<?php $path = get_option('site_path'); ?>
In this section I'll explain all the little functions for grabbing each item and how to use the functions in the previous sections to display your website. Plus some other functions that just don't fit in anywhere else. Many of these functions can be found in the includes/functions.theme.php file.
To make our lives easier, Articulate Articles comes with two very handy functions: get_header() and get_footer(). They do just what they say. They'll include the header and footer files for ease of inclusion.
There is a global variable named $posts when on the index, single, category, and search page. You can loop through these posts using the following code.
<?php
if ($posts->total > 0) {
foreach($posts->items as $post) {
// Code for each post.
}
} else {
// No posts found.
}
?>
The main thing you should get from this example is that there are two properties on the $posts variable that are important: total and items. The total is the number of posts that were found given a certain MySQL WHERE statement. $posts->items is an array that contains each of these posts, which are all instances of the post class. This means that you can use all the post properties and methods can be accessed from this new variable. In this case, $post.
You can grab all the published posts using the get_posts function. There is only one parameter that can be passed and that is an options array. It contains MySQL statements that are formatted into a nice query when it's executed to grab the posts. Although, this function can take a second boolean parameter that tells the function to make sure the posts are published.
get_posts(array( 'where' => '`post_title` = "Pie is Very Tasty"', 'limit' => 1 ));
Grabs all posts with the title "Pie is Very Tasty", and only selects the first row.
A $pages global variable is set when the browser is pointed to a specific page on the site. You access the page almost the exact same way as posts. The pages properties and methods will then be available in the $page variable.
<?php
if ($pages->total > 0) {
foreach($pages->items as $page) {
// Code for each page. There is almost always one page.
}
} else {
// No pages found.
}
?>
And there is of course a function that does the exact same thing for pages as it does for posts: get_pages. Same parameters and everything!
Same syntax for the looping, only this time you can call get_categories as the function to grab the categories. There is also a second function for retrieving a single category: get_category. This accepts two parameters. The first is the key to check and make sure it's value is equal to the second parameter.
If you would like to display a search form on your site, and don't feel like hand coding it, just call the search_form() function and pesto! You now have a fully functioning search form. Also, there is a global variable, $s, which holds the search value.
In order for comments to work, you must call the required_fields() function inside the form for comments. It will simply display two hidden inputs, so you won't need to worry about hiding them yourself.
If you want your visitors to be happy, you might want to display the value of their cookies so they won't need to type in their information every time they comment on your site. Simple add value="<?php echo field_value('NAME_OF_THE_INPUT'); ?>" to the input. For example, the name field might be this:
<input type="text" name="name" id="name" value="<?php echo field_value('name'); ?>" />
Just so I can burn it into your head, the general "loop" for the items is as followed. You would simple need to replace a couple variables and everything should be fine.
<?php
get_header();
if ($items->total > 0) {
foreach($items->items as $item) {
// Code to do to each $item
// Remember, to access properties you type: $item->property_name
// and for methods it's: $item->method_name()
}
} else {
// No items. :(
}
get_footer();
?>
You can also check to see if the current selection requires pagination by typing $items->needsPagination(). This will return either true or false. For the actually pagination, you just call the pagination method: $items->pagination(). You can pass in the type you would want. This is either "words" or "numbers". The second parameter is for some options. Here's an example of how to display words and then numbers in between them.
<?php
$items->pagination('words', array(
'next' => ' · Next Page »',
'previous' => '« Previous Page · ',
'middle' => $posts->pagination('numbers', false, false),
'forceMiddle' => true
));
?>
Notice how when I called this method for the second time inside, I passed a third parameter. This third parameter tells the script to either echo the links (true) or just return them (false).
Comments
Each comment variable (usually $comment) is an instance of the
commentclass located inincludes/class.comment.php. Below are the properties and method of this class. They can be accessed the following ways:$comment->property_nameand$comment->method_name().Properties
Methods
get_id() · the_id()These two methods are global along every post/page/category/comment/user/upload instance. They all return the id or display the id, depending on which method you called.
css($echo = true)Returns or echoes, if $echo is true, CSS rules for the li. The CSS is something along the lines of:
id="comment-POST_ID" class="alt". The class on the comments alternated every time.get_author() · the_author()Returns/echoes out the author's name.
get_author_link($format = true, $options = array()) · the_author_link($format = true, $options = array())Returns or echoes (depending on which function is called) the author's website.
If
$formatis set to false or$comment->author_siteis empty, the author's name is returned. Otherwise, it is formatted into an anchor tag with$optionsbeing used as the attributes. You call this method in the following way.get_content($format = true) · the_content($format = true)Both of these methods do the same thing, but
get_contentonly returns the content, whilethe_contentechoes it out. If$formatis set to true,$comment->contentis auto paragraphed and abbreviation tags are added.get_date($format = 'F j, Y @ g:ia') · the_date($format = 'F j, Y @ g:ia')Format
$comment->dateaccording to the$formatvariable. More information on date formats can be found in the PHP manual.get_email() · the_email()Returns/echoes out the comment author's email.
get_gravatar($format = true, $options = array()) · the_gravatar($format = true, $options = array())Returns or echoes (depending on which function is called) the Gravatar for the comment.
If
$formatis set to false, just the URL is returned. Otherwise, it is formatted into an image tag with$optionsbeing used as the attributes. You call this method in the following way.get_ip() · the_ip()Returns/echoes out the author's ip.
get_permalink($format = true, $options = array()) · the_permalink($format = true, $options = array())Returns or echoes (depending on which function is called) the permalink to the comment. It will either be
http://website.com/install_directory/?entry=POST_SLUG#comment-COMMENT_IDorhttp://website.com/install_directory/entry/POST_SLUG/#comment-COMMENT_IDdepending on the pretty permalinks option.If
$formatis set to false, just the permalink URL is returned. Otherwise, it is formatted into an anchor tag with$optionsbeing used as the attributes. You call this method in the following way.get_post_object()Returns the object of the post for that comment. Read more about posts to get an idea of what this function can do for you.
get_status()Returns a boolean value if the comment is either approved (true) or still in moderation (false).
get_website() · the_website()Returns/echoes out the author's website. If one wasn't entered, an empty string is returned.