0

I'm trying to remove the trailing slash from this link:

href="<?php echo Mage::helper('supermenu')->getLinkbyItem($item); ?>"

In the module there is a field that one uses to enter the link used in the above. I enter the link such as christmas.html but the link gets a trailing slash like this: .../christmas.html/

I found this Remove Trailing Slash From String PHP using rtrimbut don't know how to use it in this context.

2

Have you tried

echo rtrim(Mage::helper('supermenu')->getLinkbyItem($item), '/');
| improve this answer | |
  • I tried it and it and it does seem to do anything. – Freejoy Mar 13 '18 at 20:45
  • Sorry @Freejoy ... missed something ... updated. – sv3n Mar 13 '18 at 20:52
0

If I understand your question correctly, you would simply wrap the entire part that is being echoed. It would look like this:

href="<?php echo rtrim(Mage::helper('supermenu')->getLinkbyItem($item)); ?>"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.