Jump to content

Need to open link to homepage in top window (store is in an iframe)


Guest greylin

Recommended Posts

Guest greylin

I have created my store inside an i-frame on Wordpress. I knew it would be risky but decided to try anyway. It's all working really well apart from one final problem that I am stuck on because I don't know enough about PHP and I hope somebody here might be able to figure it out.

In cartNavi.inc.php lines 83-85 read:

$links[] = array (

'link' => "index.php",

'text' => $lang['front']['boxes']['homepage']);

I want to change the middle line to something like

'link' => "http://mysite.com",

which is easy enough to do BUT I also need it to open in the top window - ie, bust out of its i-frame. If it was an HTML link I could add target="_top" but how can I achieve something similar with 'link' => "index.php",?

I have added a frame buster script to the linked page but it hasn't helped with this particular homepage link.

If anyone can let me know of a fix for this I would be so grateful! Everything else is working so well it would be a crying shame to drop the i-frame because of this one final niggle.

CubeCart Version: 3.0.20

PHP Version: 5.2.14

Link to comment
Share on other sites

PHP allows dissimilar quotes to co-exist within each other. That is, a text string enclosed with "quotes" can have 'apostrophes' with in it. A text string enclosed in 'apostrophes' can have "quotes" within it. If you find yourself needing to use similar quotes, then escaping them with backslashes is required.

'link' => "http://mysite.com\" target=\"_top",

The first escaped quote will be seen as a character to be used literally and will serve as the closing quote of the URL. The second escaped quote is to be used literally and will serve as the opening quote to the target value. Cubecart will add the other necessary quote marks when it generates the HTML.

Link to comment
Share on other sites

Guest greylin

Thank you for that very clear explanation and solution, which took all of 30 seconds to implement. Not only does it work (yay!) but there's another little nugget of PHP knowledge I can tuck away for future use. Your help is very much appreciated - thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...