Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can I use an Include inside an Infobox array?


Goanna

Recommended Posts

I have the Define Mainpage contribution installed.

 

The code for it to use in index.php is simple,

 

<?php include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE); ?>

 

When I want to use the define mainpage feature though, I have to manually create an infobox. It pretty much makes the Wysiwyg Editor of the contrib usless.

 

I have to do something like this every time I use it,

 

<?php
$mainpage_title = "My InfoBox Title Goes Here";
$mainpage_info = "My HTML content goes 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);
?>

 

Now, as said, having to do it this way renders the WYSIWYG editor useless, as it doesnt understand the PHP and messes it all up.

 

Is there any way to make this array in Index.php, and have it do something like this (and I tried this, it doesnt work, it prints out a 1 instead)?

 

$mainpage_info = include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE);

 

So in other words I have to make the Include statement into a variable.

 

If anyone has any ideas on this, please let me know. Thanks.

Link to comment
Share on other sites

I have the Define Mainpage contribution installed.

 

The code for it to use in index.php is simple,

 

<?php include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE); ?>

 

When I want to use the define mainpage feature though, I have to manually create an infobox. It pretty much makes the Wysiwyg Editor of the contrib usless.

 

I have to do something like this every time I use it,

 

<?php
$mainpage_title = "My InfoBox Title Goes Here";
$mainpage_info = "My HTML content goes 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);
?>

 

Now, as said, having to do it this way renders the WYSIWYG editor useless, as it doesnt understand the PHP and messes it all up.

 

Is there any way to make this array in Index.php, and have it do something like this (and I tried this, it doesnt work, it prints out a 1 instead)?

 

$mainpage_info = include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE);

 

So in other words I have to make the Include statement into a variable.

 

If anyone has any ideas on this, please let me know. Thanks.

 

 

Hello,

 

I think that this contribution is what you are looking for.... I have it installed on a test store if you would like to see it in action....To see it is what you want before you install it...

 

Infobox Admin

 

Mike

Link to comment
Share on other sites

Hello,

 

I think that this contribution is what you are looking for.... I have it installed on a test store if you would like to see it in action....To see it is what you want before you install it...

 

Infobox Admin

 

Mike

 

Thanks, but I dont think that will work for what I need.

 

I am trying to find a way to include a seperate php file inside of a custom Infobox, instead of just a regular include statement that displays the content of the included file directly, and not inside an infobox.

Link to comment
Share on other sites

Thanks JanZ, that seemed to work!

 

Does anyone happen to know how I can make the new infobox only show up if there is content inside of mainpage.php (FILENAME_DEFINE_MAINPAGE)?

 

Also, I probably will want the Infobox Title to be different every now and then. Anyone have any ideas on how to do that dynamically?

 

Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...