Author Topic: Showing digits instead of keywords  (Read 4864 times)

0 Members and 1 Guest are viewing this topic.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Showing digits instead of keywords
« on: November 20, 2009, 04:23:12 PM »
Hello,

How can I tweak the Keywoords code in the functions.php to give as results something like:

So if you have 3 keywords, it will show in the details page something like:
1, 2, 3

Instead of:

Barcelona, Madrid, Malaga

That means that for some reason I do not want to show the value of the keywords, but only the digits.


This is the code of functions.php:

Code: [Select]
  if (!empty($image_row['image_keywords'])) {
    $split_keywords = explode(" ", $image_row['image_keywords']);
    $keywords = "";
    $keywords_count = 0;
 
    foreach ($split_keywords as $key => $val) {
    $keywords_count++;
 
      $keywords .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".urlencode($val))."\">".format_text($val, 2)."</a>";
    }
  }
  else {
    $keywords = REPLACE_EMPTY;
  }

  if (!check_permission("auth_readcomment", $image_row['cat_id'])) {
    $image_row['image_allow_comments'] = 0;
  }

Many thanks in advance for you help,
Cruxy

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Showing digits instead of keywords
« Reply #1 on: November 20, 2009, 04:36:17 PM »
... not tested ...
... use instead of : keywords ...
Code: [Select]
format_text($val, 2)

... this : keywords_count ...
Code: [Select]
$keywords_count
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing digits instead of keywords
« Reply #2 on: November 20, 2009, 04:50:21 PM »
Perfect Mawenzi. It is working!

I thank you very much for your help.

Cruxy

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Showing digits instead of keywords
« Reply #3 on: November 21, 2009, 05:24:57 AM »
Will I have nightmares if I get answer for: "why would you need this?"
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: Showing digits instead of keywords
« Reply #4 on: November 21, 2009, 06:45:11 AM »
What ?  8O

What kind of a modification is this ?  :roll: .. ?  :?:
I'm Back :)

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Showing digits instead of keywords
« Reply #5 on: November 21, 2009, 09:40:23 PM »
Do not worry guys. I am using the same code for something else on my 4 images gallery. Instead of keywords I am getting images ids. So It was the easiest way to get the best help, otherwise it would cost me an hour to explain what I want.

Cheers,