Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

URL Links within PHP ?


estebaan

Recommended Posts

Hi, although I'm using the Define MainPage module I think my question is a general support question. If not mods please feel free to move as you see fit.

 

Basically, on my main page I want to put some text within an 'info box' which is straightforward using define mainpage, but I want to contain some extra hyperlinks to products that I store on my shop - for example, I sell CD's and I get a regular shipment in each week. I want a quick and easy method of listing all of the new shipments in that week and putting clickable links to those new items.

 

I can do this no problem using HTML but I want to contain my text and links within a nice looking 'info box' as follows:

<table width="100%" cellpadding="1" cellspacing="0" border=0>
   <tr>
    <td class="main" width=50% valign="top" align="right">
<?php
$mainpage_title = "Name of Information Box goes here";
$mainpage_info = "

MY FRONT PAGE TEXT HERE

HYPERLINK TO PRODUCT HERE???

";
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left',
                              'text'  => $mainpage_title );
 new infoBoxHeading($info_box_contents, true, true);

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left',
                              'text'  => $mainpage_info);
 new infoBox($info_box_contents);
?>

 

So in the above example (basically taken from the define mainpage contrib) it gives me a nice box with a bordered header and I can enter whatever text I like within the mainpage info quote marks. I can't just put in a link in the usual way (a href... etc) because it comes back with an error.

 

I'm sure this is easy to do - but I'm stumped. Any help would be appreciated...!

 

Thanks

Link to comment
Share on other sites

I think the html won't work because you need to close the php bracket then reopen it, so:

 

$mainpage_info = " 

?> then html here

<?php

";  $info_box_contents = array();

 

That might not be right though. Maybe $mainpage_info isn't built to hold a text string? I don't know without looking into it further, that's just what occurred to me off the top of my head and I thought I'd answer because no one else did!

Link to comment
Share on other sites

I think the html won't work because you need to close the php bracket then reopen it, so:

 

$mainpage_info = " 

?> then html here

<?php

";  $info_box_contents = array();

 

That might not be right though. Maybe $mainpage_info isn't built to hold a text string? I don't know without looking into it further, that's just what occurred to me off the top of my head and I thought I'd answer because no one else did!

 

Hi, thanks for your response. It didn't seem to do the trick unfortunately. I think the mainpage_info part (between the quote marks) needs to be complete rather than broken by the php close and reopen. Sorry, I'm a complete novice when it comes to this...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...