![]() |
|
automaticaly insert links to tags if tag word occures in image description - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: automaticaly insert links to tags if tag word occures in image description (/thread-2212.html) |
automaticaly insert links to tags if tag word occures in image description - BertSimons - 2008-02-07 wrote this function so if you type a word in the image description that is a tag it becomes a link to all the other occurences of this tag. `function getImageDesc() { if(!in_context(ZP_IMAGE)) return false; global $_zp_current_image; $desc = str_replace("rn", "n", $_zp_current_image->getDesc()); $result = query_full_array("SELECT foreach($result as $row){ $alltags = $alltags.$row['tags'].","; } $result = query_full_array("SELECT foreach($result as $row){ $alltags = $alltags.$row['tags'].","; } $alltags = explode(",",$alltags); $alltags = array_unique( $alltags); foreach($alltags as $tag){ $replace="".$tag.""; $desc=str_replace($tag, $replace, $desc); } return str_replace("n", "", $desc); }` |