4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: ruudvroon on October 28, 2005, 08:04:07 PM
-
How can I add the keywords (without links) to the alt description?
I tried to add {image_keywords} to the media template, but I get random keywords :?
-
Has anyone figured out how to do this? I see the image keywords is coming from the random image in the page. How do you get the main image to have it's main keywords?
Thanks
-
Please someone, I need it because i want google image search can find the images.
-
I made a sollution:
Open includes/functions.php
Find:
else {
$user_name = $lang['userlevel_guest'];
$user_name_link = $user_name;
}
Add below:
if ($detailed_view) {
if (!empty($image_row['image_keywords'])) {
$split_keywords2 = explode(" ", $image_row['image_keywords']);
$keywords2 = "";
foreach ($split_keywords2 as $key2 => $val2) {
$keywords2 .= (($keywords2 != "" ) ? ", " : "")."$val2";
}
}
$site_template->register_vars(array(
"alt_keywords" => $keywords2,
));
}
Open templates/{your_template}/media/jpg.html
Find:
alt="{image_name}"
Replace with:
alt="{image_name}, {alt_keywords}"
Is there someone who can add the , in the {alt_keywords} because you now you also get a , when there're no keywords?
-
alt="{image_name}{if alt_keywords}, {alt_keywords}{endif alt_keywords}"
-
Perfect. Thanks a bunch guys.
-
mayby an stupid question, but what if i want to show the image description ?
-
Open includes/functions.php
Find:
else {
$user_name = $lang['userlevel_guest'];
$user_name_link = $user_name;
}
Add below:
if ($detailed_view) {
$description2 = (!empty($image_row['image_description'])) ? format_text($image_row['image_description'], 1) : REPLACE_EMPTY;
if (!empty($image_row['image_keywords'])) {
$split_keywords2 = explode(" ", $image_row['image_keywords']);
$keywords2 = "";
foreach ($split_keywords2 as $key2 => $val2) {
$keywords2 .= (($keywords2 != "" ) ? ", " : "")."$val2";
}
}
$site_template->register_vars(array(
"alt_keywords" => $keywords2,
"alt_description" => $description2,
));
}
Open templates/{your_template}/media/jpg.html
Find:
alt="{image_name}"
Replace with:
alt="{image_name}{if alt_description}, {alt_description}{endif alt_description}"
-
Great this is the right way,
it works in detailview, but is it also possible in the categoriesview and on the indexpage
-
Yeah thats all great.
Is it possible to have the image description AND the keywords :?:
That would be absolut fantastic :mrgreen:
-
just use the code from the description:
Open templates/{your_template}/media/jpg.html
Find:
alt="{image_name}{if alt_description}, {alt_description}{endif alt_description}"
Replace with:
alt="{image_name}{if alt_keywords}, {alt_keywords}{endif alt_keywords}{if alt_description}, {alt_description}{endif alt_description}"
Or:
alt="{image_name}{if alt_description}, {alt_description}{endif alt_description}{if alt_keywords}, {alt_keywords}{endif alt_keywords}"
-
Ruud, can you please take a look how i can place it in index page and the categoriespage
thanks in advance
-
Thanks ruudvroon :D
Great MOD i think.
It is working perfect for me.
Just one thing, which could irritate the beginners.
You forgot the alt="" tag in front of the code which must be replaced.
alt="{image_name}{if alt_description}, {alt_description}{endif alt_description}{if alt_keywords}, {alt_keywords}{endif alt_keywords}"
:mrgreen:
-
little correction
these lines: "alt_keywords" => $keywords2,
"alt_description" => $description2,
should be like this: "alt_keywords" => str_replace("\"", """, $keywords2),
"alt_description" => str_replace("\"", """, $description2),
to avoid conflict if a description or a keyword contain a quote
-
V@no, master of 4images, can you tell me what and wich pages i have to change if i want to show the description also on the indexpage(home) and the categoriespage and not only the detailview
-
Hello!
On my 4images galerie version 1.7.1 it was working perfectly.
Now i have updated on version 1.7.4 and it is NOT working anymore.
I would also like to have this for SEO reasons under version 1.7.4
Thanks for support on this old but good topic.
-
Hi,
i also want to use this MOD for SEO-optimizing.
Perhaps {alt_keywords} couldnt be used in the metatags in this way?