Title: Additional fields by category [DLE ALL]
Author: everyone who thought of it
The author of this method: DomiTori
CMS: any version of DLE
Description:
The other day, such an idea came to mind. Make a hack that allows you to divide additional hyperlink fields into categories in links. Having conjured half the night, I managed to breathe life into this hack. It will be useful both for movie portals, vareznik, culinary sites and others.
What does this hack do.
I created two additional fields on the test site for experiments
genre|Genre of the work||text||1|1|0|0
year|Year of release||text||1|1|0|0
Initially, cms DLE allows you to sort by these additional fields by a common link
website.<url>/xfsearch/action movie
site.<url>/xfsearch/2014
In the hack, we change the annoying xfsearch to a more logical word in the address. I described how to change xfsearch to any other word that you like.
Now the idea is this:
Replace xfsearch with the Latin name of the additional field, thus dividing them into categories.
Now visually.
Above I described the data from xfields.txt . As you can see, I have two additional fields, I named them genre and year. Now I'll show you how to replace the site link.<url>/xfsearch/ to the website.<url>/genre/ and website.ru/year/.
Let's proceed with the installation.
1. Search in the files engine/modules/show.short.php , engine/modules/show.custom.php and twice engine/modules/show.full.php
$value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode( $value2 ) . "/\">" . $value2 . "</a>";
Replace with
$value3[] = "<a href=\"" . $config['http_home_url'] . "".$preg_safe_name."/" . urlencode( $value2 ) . "/\">" . $value2 . "</a>";
This will replace xfsearch with the Latin name of the additional field.
2. In the file.htaccess is looking for
RewriteRule ^xfsearch/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]
RewriteRule ^xfsearch/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=xfsearch&xf=$1&cstart=$2 [L]
Insert below
RewriteRule ^genre/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]
RewriteRule ^genre/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=xfsearch&xf=$1&cstart=$2 [L]
RewriteRule ^year/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]
RewriteRule ^year/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=xfsearch&xf=$1&cstart=$2 [L]
This is how we make a redirect.
It is clear that you have different additional fields from mine, someone has more of them. You need in .htaccess to insert separately on each additional field
RewriteRule ^Latin name of the additional field/([^/]*)(/?)+$ index.php?do=xfsearch&xf=$1 [L]
RewriteRule ^Latin name of the additional field/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=xfsearch&xf=$1&cstart=$2 [L]
That's all. Is it really easy and simple?)