Author Topic: the separator between subcategories in home cat list $sub_cat_list .= ", ";  (Read 6628 times)

0 Members and 1 Guest are viewing this topic.

Offline webmaster73

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
hello.

it took me more than an hour of research to find out on my own that the separator between subcategories in the home page (default is comma) is burried deep into includes/functions.php

        $sub_cat_list .= ", ";

I wish this could be well documented somewhere, and even put as an option in the admin panel ......  (the separator in the location bar - ok clickstream - in the page header is already something you set in the admin panel ..... )


I am just against hardcoding as a matter of principle.


Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
yeah, we know your statement about coding ;)
cheers
Nicky
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 ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline webmaster73

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
yeah, we know your statement about coding ;)

Nicky don't hate me please.... but 4images is one of the most successful gallery scripts, if not the most successful one.

I love it. I use it on more than five domains. Yes, I did need to install a few hacks and to tweak .htaccess files to get many of its resource-greedy functions (such as checknewimages) to work, but I still consider it as an awesome script. I give 4images thumbs up on its functions, and for me it stands far ahead of any other competitor including menalto.

I believe 4images did a lot to the community, and it has not had the reward it deserves.

Yet, I need to draw maybe your attention to the fact that when used in other languages (say for example, arabic) the default comma separator between subcategories does not stand out nicely, at least not in any of the styles I have tried. The comma appears too close to the name of the subcat to the point where it disturbs the eye. Thus my suggestion to make this an option not something hardcoded.

I hope you would forgive my weak expression in English which is not my mother tongue.

Danke

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
i don't hate you, why should i.

maybe my previous post was to sarcastic, but you're right in that point, due i saw some arabic 4images sites.

i apologize
cheers
Nicky
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 ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
In includes/functions.php file,

find:

Code: [Select]
function get_subcategories($parent_id) {
  global $cat_parent_cache, $cat_cache, $site_sess, $config;

replace:

Code: [Select]
function get_subcategories($parent_id) {
  global $cat_parent_cache, $cat_cache, $site_sess, $config, $site_template;

After - find:

Code: [Select]
$sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";

replace:

Code: [Select]
$site_template->register_vars(array(
"num_subcats" => true,
"sub_url" => (isset($sub_url) && !empty($sub_url)) ? $sub_url : "",
"subcat_name" => format_text($cat_cache[$subcat_id]['cat_name'], 2)
));
$sub_cat_list .= $site_template->parse_template("categories_subcats");

find:

Code: [Select]
$sub_cat_list .= ", ";

replace:

Code: [Select]
$site_template->register_vars("subcats_comma", true);
$sub_cat_list .= $site_template->parse_template("categories_subcats");

find:

Code: [Select]
$sub_cat_list .= " ...\n";

replace:

Code: [Select]
$site_template->register_vars("three_dots", true);
$sub_cat_list .= $site_template->parse_template("categories_subcats") . "\n";

In templates/your_template , create new file: categories_subcats.html .

Add:

Code: [Select]
{if num_subcats}<a href="{sub_url}" class="subcat">{subcat_name}</a>{endif num_subcats}
{if subcats_comma}, {endif subcats_comma}
{if three_dots}...{endif three_dots}

Now - you speak HTML. ;)
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 webmaster73

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
thank you Nicky

Thank you Thunderstrike, but I simply wanted to replace the comma with two spaces, which was as simple as replacing

$sub_cat_list .= ", ";

with
$sub_cat_list .= "&nbsp;&nbsp; ";

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Is ok - if use this - is same for space:

Code: [Select]
$sub_cat_list .= REPLACE_EMPTY . REPLACE_EMPTY;

;)
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 webmaster73

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
 :lol: isn't it nice when I myself can't remember how I did something, but I remember I did write here on 4images forums the final solution I came up with here so that the other members of the 4images communinty may be able to find this solution easily without having to do all the searching I did ??

Now I myself needed to see what I wrote back then.....

thank you again Nicky and Thunderstrike and long live 4images