I have the following function, but as I am not a pro programmer, I don’t know how to achieve my goal. here is the code and I will explain what I wanted below.
$menu = $db->GetAll($sql);
foreach ($menu as $row) {
$label = '<a href="'.$row[MENU_URL].'">';
$label .= $row[MENU_TITLE];
$label .= '</a>';
What I wanted to do is id $label .= $row[MENU_TITLE]; contains http://, then open that link in a new tab. I am sure there many great progrmammers who can achieve this with few ways, I am sure Jeff will do it in seconds…. as many others can do it.
Please someone help me to solve this problem
Thank you
Zaheen
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Hi Zaheen,
You can use the strpos function to check for the http within the string and then conditionally add the target=”_blank” attribute to your anchor 
if( substr($row[MENU_URL], 0, 4) == "http") {
to solve the problem and now its ok
Anyways this is so great forum to get help.
Thank you again
Zaheen
