Author Topic: Count image_keywords  (Read 3715 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Count image_keywords
« on: December 18, 2007, 07:56:37 PM »
Hi,

How can I count the imgae_keywords for each image.
I want something like:
Keywords (3): Keyword1, Keyword2, Keyword3

Thank you in advance for any help  :)
 

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Count image_keywords
« Reply #1 on: December 18, 2007, 08:28:20 PM »
In includes/functions.php file,

find:

Code: [Select]
$keywords = "";

add after:

Code: [Select]
$keywords_count = 0;

find:

Code: [Select]
foreach ($split_keywords as $key => $val) {

add after:

Code: [Select]
$keywords_count++;

find:

Code: [Select]
"image_keywords" => $keywords,

add after:

Code: [Select]
"image_keywords_count" => (isset($keywords_count) && $keywords_count > 0) ? (int)$keywords_count : "",

In templates/your_template/details.html file - use:

Code: [Select]
{if image_keywords_count}({image_keywords_count}){endif image_keywords_count}

before keywords text.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Count image_keywords
« Reply #2 on: December 18, 2007, 10:00:56 PM »
Perfect, Thank you!