I have a PHP function to covert certain text to lowercase, remove special characters and replace space with hyphens.
I want to place them in some modules to create a link to images from the category name.
For example Modzzz Meet Me module.
Now the URL formed from the category is .../special-icons/Play.png or .../special-icons/Listen / Watch.png
It must be .../special-icons/play.png or .../special-icons/listen-watch.png
Below the function:
function clean($string) {
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
$string = strtolower($string); // Convert to lowercase
return $string;
}
I have some trouble placing this inside the current code and make it work only for that line.
Below the code (from in this case Modzzz) with the key to show the meeting type. I marked the line that we try to change in yellow.
...
$aAuthor = getProfileInfo($aData['author_id']);
$sOwnerThumb = $GLOBALS['oFunctions']->getMemberThumbnail($aAuthor['ID'], 'left');
$iLimitChars = (int)getParam('modzzz_meeting_message_length');
$aVars = array (
'id' => $aData['id'],
'post_uthumb' => $sOwnerThumb,
'meeting_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aData['uri'],
'meeting_title' => $aData['title'],
'country_city' => _t($GLOBALS['aPreValues']['Country'][$aData['country']]['LKey']) . (trim($aData['city']) ? ', '.$aData['city'] : ''),
'meeting_date' => date('d F', $aData['when']),
'meeting_type' => $this->parsePreValues ('MeetType', $aData['meet_type']),
...
Hopefully someone knows what to change. I tried it a couple of times, but I get a totally blank screen of everything appears, but it has no effect.