// $Id: INSTALL.txt, v 1.0 2008/10/02 16:37:14 Quiptime $

Installation
------------

1) Important: The module does not work with any theme. Please read the Requirements.

But, if the theme requirements are satisfied with point 2), 3) and 4) thereafter.

2) Copy the ajax_loading modul folder into the modules directory.

3) Enable the 'ajax_loading module' in admin/build/modules.

4) Configure the module permission 'Access ajax content loading' in /admin/user/access.

5) Optional: You can create templates for the module. Please read the Instructions.

6) Optional: You can create a own JS file. Please read the Instructions.


Instructions
------------

You can optional define two module templates.

1) Module template 'ajax_loading_content.tpl.php'

1a) Put this code in your theme 'template.php'.

function phptemplate_ajax_loading_content($nid) {
  return _phptemplate_callback('ajax_loading_content', array('nid' => $nid));
}

1b) Create the template file 'ajax_loading_content.tpl.php' itself.

The template file code:

<?php /* $Id: ajax_loading_content.tpl.php, v 1.0 2008/10/03 11:24:14 quiptime $ */
  $output = '';
  $output = node_view(node_load($nid), FALSE, FALSE, TRUE);
  print $output;
?>

2) Module template 'ajax_loading_output.tpl.php'

2a) Put this code in your theme 'template.php'.

function phptemplate_ajax_loading_output($out) {
  return _phptemplate_callback('ajax_loading_output', array('out' => $out));
}

2b) Create the template file 'ajax_loading_output.tpl.php' itself.

The template file code:

<?php /* $Id: ajax_loading_output.tpl.php, v 1.0 2008/10/03 11:25:34 quiptime $ */
  $output = '';
  $output = drupal_to_js(array('mycontent' => $out, 'css_id' => 'content'));
  print $output;
?>

3) Extra Javascript file for more jQurey click actions

The Ajax loding module enable two jQuery click actions.

First) A click action on the node title link.
Second) A click action on the 'read more' link.

To define other or more jQuery click actions you can craete a extra Javascript file an put 
your jQuery code in this file. This file must be called or be linked. 
To do this they can do the following:

Install one of the two template files in your theme folder an put the Javascript file code this file.

drupal_add_js(path_to_theme() . '/your_extra_js_file.js');


Theme requirements - IMPORTANT
------------------------------

1) General

The theme used must be 2 meet requirements so that the module can proper working.

1a) Using a certain CSS formatting so that Ajax request to click on a link can be called.

1b) Using a certain CSS formatting so Ajax content can be displayed.

2) The first theme requirement

CSS formatting so that Ajax request to click on a link can be called.

So that the module works is a certain CSS ID required! These CSS ID is from node template 'node.tpl.php' and 
the node-type templates 'node-nodetype.tpl.php' generated. This CSS ID has the name scheme 'node-x'. 
The x is a node ID. HTML code sample:

<div id="node-1">

The 'ajax_loading module' does not work when such CSS ID's are not used. In this case, please update the 
node template and all node-type templates used by the theme.

Here is the proper code for the node template files:

<div class="<?php print $node_classes ?> node-<?php print $node->nid; ?>" id="node-<?php print $node->nid; ?>">

The important part in this code is:

id="node-<?php print $node->nid; ?>"

If this important part of the code is not in the node templates and node-type templates included then they must 
all node templates change. The module folder 'docs' contains a file "node.tpl.php.example" as an example for the 
implementation of the important code part.

3) The second theme requirement

The CSS formatting so Ajax content can be displayed is the CSS ID 'content'. This CSS ID is usually used 
in the 'page.tpl.php' file. HTML code sample from a "page.tpl.php":

<div id="main" class="column">
  <div id="squeeze" class="clear-block">
    <?php if (!empty($mission)): ?>
      <div id="mission"><?php print $mission; ?></div>
    <?php endif; ?>
    <?php if (!empty($content_top)):?>
      <div id="content-top"><?php print $content_top; ?></div>
    <?php endif; ?>
    
    <div id="content">
    
      <?php if (!empty($title)): ?>
        <h1 class="title"><?php print $title; ?></h1>
      <?php endif; ?>
      <?php if (!empty($tabs)): ?>
        <div class="tabs"><?php print $tabs; ?></div>
      <?php endif; ?>

The important part in this code is:

<div id="content">

3a) You have 2 options.

First) Update your 'page.tpl.php' and place the CSS ID 'content'.

Second) Create the file 'ajax_loading_output.tpl.php' and overwrite in this template the CSS ID 'content'.

Template code part:

$output = drupal_to_js(array('mycontent' => $out, 'css_id' => 'content'));

Here you can replace 'content' with a different ID CSS.
