Provide a variable: $prev_next_content for 'node.tpl' to display links of the previous and next node which are the same type with current node.

Similar project: Previous/Next API

Contrast with module: prev_next, this module is more simple, and most sites can use directly, e.g. http://www.w3cplus.com is using this module's function now.

prev_next_demo.jpg

Sandbox project page: https://drupal.org/sandbox/stevenjia/2281811

git clone stevenjia@git.drupal.org:sandbox/stevenjia/2281811.git prev_next_content

Uses:

1.Enable content types which should display "Prev | Next" links at:"admin/config/user-interface/prev_next_content_settings".

2.Find a position to output the $prev_next_content variable in node.tpl.php:

<!-- Prev next content -->
<?php if (isset($prev_next_content)): ?>
  <?php print $prev_next_content; ?>
<?php endif; ?>

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxstevenjia2281811git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

stevenjia’s picture

Issue summary: View changes
stevenjia’s picture

Issue summary: View changes
stevenjia’s picture

Status: Needs work » Needs review
zterry95’s picture

This module is duplicated with flippy.
https://drupal.org/project/flippy

Also flippy is more powerful and easy to use.

mattcoker’s picture

You should try creating a README.txt that actually goes in depth into how the module works, without PHP if you can. It is not very helpful as is.

For the most part, I agree wtih zterry95. This module seems to work, but is less flexible and requires template overrides to work.

stevenjia’s picture

@zterry95, flippy is really powerful... but as a developer, i think it's too large for this small function.

i just found another very similar module: pager_for_content_type, the difference with mine is that it adds everything in $content to display automaticly, but usually needs style work.

Let me say a good word for my module,
1.it is sepecially for using of this style: "Prev: contetnt A | Next: content B", and i know there are some projects are using it, so maybe it's very suitable for some projects' reqirement. and i will consider to support some beautiful style for developer to choose.
2.although this module needs you to add an variable to template, but i think it will be more flexible for developer to place anywhere you want.

stevenjia’s picture

@mattcoker, thanks for your remind, i added a README.txt already.

I think this module is so small that maybe most developers can copy its code into his custom module directly to reduce module's quantity :)

bmeme’s picture

Status: Needs review » Needs work

This is a little bit out of standard:

/**
 * Return html content of $prev_next_content.
 */
function previous_next_content($nid, $type) {

It should be something like:

/**
 * Return html content of $prev_next_content.
 */
function previous_next_content_output($nid, $type) {

or something like this as you prefer. Read about Drupal naming at: http://drupal.org/node/318#naming

There are also some little issues in Pareview.sh. See at: http://pareview.sh/pareview/httpgitdrupalorgsandboxstevenjia2281811git.

Then another thing: your module isn't ready for a website that hosts more than a language. This is a very big limit IMHO. I suggest you review this part of code:

  $sql_previous = "SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 AND n.nid < :nid AND n.type = :type ORDER BY n.nid DESC";
  $result_previous = db_query_range($sql_previous, 0, 1, array(':nid' => $nid, ':type' => $type));

  $sql_next = "SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 AND n.nid > :nid AND n.type = :type ORDER BY n.nid ASC";
  $result_next = db_query_range($sql_next, 0, 1, array(':nid' => $nid, ':type' => $type));

adding an "AND" clause to filter for $language->language global. Or something like this :)

Bye!

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.