Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Include HTML and Text Boxes V 1.0


kymation

Recommended Posts

This contribution was designed to allow easy editing of the large blocks of text on the Index page, Conditions, and Privacy pages. These text blocks have been separated out into HTML files that can be edited with any HTML editor. This should be useful to those who don't understand php code, those who want to put fancy HTML into those pages, and those of us who are designing for clients and don't want said clients messing up the code.

 

As a bonus I've included a couple of files that make it easy to have text in a box on the front page, or just about anywhere for that matter. These text boxes also use separate HTML files to hold the content.

 

I've tried to make this Contribution as simple as possible so that even the newest osCommerce user can use it. If you have any problems please post here and I'll help.

 

This version supports: osCommerce 2.2 MS2 (and probably any earlier version as well).

 

The original thread that spawned this contribution is here, for those who are interested in archaeology.

 

Thanks again to all the great people on the forums, and special thanks to the osCommerce development team.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

The problem with converting the header to HTML is that most of it is automated. The breadcrumb trail changes depending on where you are on the site. The My Account / Cart Contents etc. links and images change depending on whether you are logged in or not. The only stable part of the header is the logo, and there's already a contribution for changing that.

 

This contribution was designed to be a simple way of dealing with a large area of static HTML. This only applies to a very few pages since the bulk of osCommerce is automated and database-driven. A full template system does a much better job of separating the HTML from the code, but requires more effort to install. There are a couple of template systems available in the contributions for those who need this increased functionality. I suggest that you try one of those.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 4 months later...

Hi,

 

I am think about adding this to the categories. We have category description installed and would like to get popup windows as well. Will I be able to add them with your contrib?

 

Greetings and thx in advance, Michael

Not because it is difficult we don't dare to do it, but because we don't dare to do it, it is difficult. (Seneca)

Link to comment
Share on other sites

I don't think that this contribution would be of any help to you. The categories box is all code-generated. There's not much you can do there with static HTML.

 

You might be able to use the new categoryTree class from the CVS. Harald showed some example code in this thread. It appears to me to be a signifigant improvement.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Jim,

thanks for this very usefull contribution.

I use osc for 3 month now and setup all kinds of design mods liks sts and sendorder html email etc.

see http://www.oscommerce.com/community/contri...all/search,html

 

For this last one its very difficult to design the look of the send email.

 

Also all email send by osc is difficult to design. Your contribution is very usefull for this but Iam not sure. Can I use it herefore? if so how?

Keesjan

Link to comment
Share on other sites

This contribution was designed to insert HTML files into the osCommerce site pages. The requirements for HTML email are a bit different, so this contribution won't really work for that purpose. I'm not familiar enough with HTML formatting in email to advise you on that subject.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

hi i have a sid problem on my link after i attached image to one of the HTML file.

 

The funny thing is when you first open your browser, then when you point to any link, the sid is there. But once one click something, then the sid dissapear.

 

Can anybody help, is this fine? I read from the readme.txt file that sid is a security problem.

 

Thank you,

Link to comment
Share on other sites

Sorry, even if i don't attached any image to one of those html files (conditions, privacy, shipping, etc). Still when i first open the web browser any links will contain sids.

 

After i click any link then the sid will be gone.

 

Help, is this normal?

 

Thank you for the help.

Link to comment
Share on other sites

  • 2 weeks later...

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/www/gadgetwarehouse/shop/includes/functions/database.php:13) in /home/www/gadgetwarehouse/shop/includes/functions/database.php on line 13

 

 

Does anybody know why these errors show up.. :o

Link to comment
Share on other sites

The Database functions are being called twice. The most likely cause would be copying the code file to the location for the language file. That is, you copied index.php to includes/languages/english/index.php. If this is showing up on a different page, substitute that filename for the index.php.

 

Other ways of causing this are including database.php in another file, or including application_top.php more than once. Look at any locations where you have made modifications for these errors.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 1 year later...

Can a mod of your contribution do this?

 

eg

### database

#prod-name #prod-desc #prod-url

#test1 #description of test1 #catalog/prod-url/test1.html

 

### product info page

 

test1

description of test1

 

<? include("catalog/prod-url/test1.html") ?>

 

 

A search of the forum suggests your contrib is the way to go but... I don't know how :blush: . Which file do I edit - is it product_info.php? What do I need to put in prod-desc field? Do I need to alter table?

 

Thanks.

Christopher Dang

Edited by chrisamydang
Link to comment
Share on other sites

It could be modified to do what you describe, at least if I understand you correctly. This contribution was originally designed to make it easy to create and update static pages and parts of pages.

 

Perhaps if you can give me more information on what you are trying to do I could give you more help.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim

 

Thanks for the reply

 

This is essentially what I want to do:

 

For the dynamic product info page

- delete code for "click here for more info" (can do that no worries)

- add <?php include("http:// ****$product_info['products_url']*** "); ?>

i.e. <?php include("http://www.acme.com.au/prod-info-pages/infopage1.html"); ?>

 

So I want the dynamic product pages to include the contents of a static page which is referred to by the product_url field of the catalog database.

 

The following addition include addition works (therefore it's not a problem with the include function):

<tr>

<td>

<?php include("http://www.acme.com.au/prod-info-pages/infopage1.html"); ?>

</td>

</tr>

 

But the following wont

<tr>

<td>

<?php include('"http://' . $product_info['products_url'] . '"'); ?>

</td>

</tr>

 

Despite the fact that

<?php echo '"http://' . $product_info['products_url'] . '"'; ?>

results in

"http://www.acme.com.au/prod-info-pages/infopage1.html"

which is what I want inside the include tags!

 

I've done a search for this in the forums and it would appear it's a common request which inevitably leads to your contribution, but again I don't know how...

 

I think this would be a welcome mod because if the site has a local copy of the product pages the product info pages will be fuller and does not require a prospective client to goto an external site and thus decreasing the likelihood of a sale.

 

Thanks

Chris

Link to comment
Share on other sites

Your code is trying to include a URL when it should be trying to include a file. Try

<tr>
<td>
<?php include($product_info['products_url']); ?>
</td>
</tr>

and make the products_url contain something like /usr/www/mysite/path/to/file/filename.html.

 

That assumes that the file contains a proper HTML fragment. It you're trying to include an entire web page then we'll need to adapt the parsing code from the contribution. If you're trying to load a page from an external site, then the problem becomes much more difficult.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

That works perfectly!

 

Nagging question though:

 

If the following has been verified to work for a particular product(domain and prod name fictional):

<?php include("http://www.acme.com.au/prod-info-pages/infopage1.html"); ?>

 

Why doesn't the following code work?

<?php include('"http://' . $product_info['products_url'] . '"'); ?>

 

They should equate to the same html code, at least for that one particular product.

 

Regardless, it works fine, and I'm going to put it up under another thread with all credit going to you. :thumbsup:

 

Again thank-you.

 

Now I just need to do a sed substitution command on my easypopulate file!

 

Regards,

Christopher

Link to comment
Share on other sites

  • 1 year later...

I am trying to install this module and the readme file says to modify the index.php at a line where it reads

 

<tr>

<td class="main"><?php echo TEXT_MAIN; ?></td>

</tr>

 

In my file, it never says this. Also, in the conditions.php file it says to find line with this:

 

<tr>

<td class="main"><?php echo TEXT_INFORMATION; ?></td>

</tr>

 

I don't find it there either. All my file says is:

 

<?php

/*

$Id: conditions.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE', 'Conditions of Use');

define('HEADING_TITLE', 'Conditions of Use');

 

define('TEXT_INFORMATION', 'Put here your Conditions of Use information.');

?>

 

So I think this 2003 version does not work with the latest os commerce version. Is there something newer to allow html on the special information pages?

Link to comment
Share on other sites

I am trying to install this module and the readme file says to modify the index.php at a line where it reads

 

<tr>

<td class="main"><?php echo TEXT_MAIN; ?></td>

</tr>

 

In my file, it never says this. Also, in the conditions.php file it says to find line with this:

 

<tr>

<td class="main"><?php echo TEXT_INFORMATION; ?></td>

</tr>

 

I don't find it there either. All my file says is:

 

<?php

/*

$Id: conditions.php,v 1.4 2002/11/19 01:48:08 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE', 'Conditions of Use');

define('HEADING_TITLE', 'Conditions of Use');

 

define('TEXT_INFORMATION', 'Put here your Conditions of Use information.');

?>

 

So I think this 2003 version does not work with the latest os commerce version. Is there something newer to allow html on the special information pages?

You're looking in the wrong place. You want the catalog/index.php file, not catalog/includes/languages/english/index.php (and similarly for the catalog/conditions.php file) Also, if you have added other contributions, or if you are using a "loaded" or non-standard version of osCommerce, the lines you are looking for may be missing or different. The changes should work just fine with an unmodified copy of the latest version of osCommerce.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 8 months later...

Hello Jim,

 

I installed the contribution and it works fine but now I am trying to fill in the text via a cms.

I setup a database in my voorwaarden.php (dutch for conditions) I changed:

 

<td class="main"><?php echo TEXT_INFORMATION; ?></td>

 

into:

 

<td class="main"><?php
//  Lines added for Include HTML and Text Box Contribution V. 1.6
  $html_file = DIR_WS_LANGUAGES . $language . '/html/' . basename($PHP_SELF,".php") . '.txt.php';
  $html = implode("", file($html_file));
  echo ereg_replace("(<!doctype([^>]+)>)|(<[/]?html>)|(<head>(.*)?</head>)|(<[/]?body([^>]+)?>)", '', $html);
?></td>

 

and I changed the voorwaarden.html in voorwaarden.txt.php and I checked if that would work and it did with the standard text.

 

I then changed the code for voorwaarden.txt.php in this:

 

<?php
//CMPS
//KCST 2007

//error codes
ini_set('displayerrors', 1);
error_reporting(E_ALL);

//Verbinding met database maken
include("connect.inc.php");

//Pagina ophalen
$page_SQL="SELECT * FROM webpages WHERE page_id=4";
$page_result=mysql_query($page_SQL);
$page=mysql_fetch_array($page_result);
mysql_close();
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
	<title>
		(This file goes in /catalog/includes/languages/english/html/)
	</title>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
	<?php
//Hier worden de berichten weergegeven 
{
?>
<?php echo $page['inhoud'] ?>
<?php
}
?>
</body>

</html>

 

If I Click on Voorwaarden in the Information box I have no text on the page and if I check the voorwaarden.txt.php page I see the text that is in the database.

So it reads the text from the database but it is not displayed in the page of the website.

Can you help me with this?

Thanks.

Diederick

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...