Forums / Addon Templates / Easy embed template

Easy embed template

Locked
Results 1 to 20 of 362
This thread is locked. New replies are disabled.
28 Jul 2006, 19:06
#1
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Easy embed template

HI there,
Though out last year I had developed an 'easy embed template' for Zen Cart 1.2.x.
All you had to do was define a template file for your site in the config, and through a long set of REGULAR EXPRESSIONS it would put what ever you had for the rest of your site around your zen cart. embedding it in in site of the master template.
Well for ver 1.3.x I am going to realease that code. this is the starter thread.
below I am going to paste all the expressions, please feel free to make any suggestions as, I stumbled through making them and could use the communities help.

JOsh

[PHP]//strip some duplicate tags that zen cart manages itself
$sitetemplate=preg_replace('/<!DOCTYPE.*?>/si', '', $sitetemplate);
$sitetemplate=preg_replace('/<meta.*?>/si', '', $sitetemplate);
$sitetemplate=preg_replace('/<html.*?>/si', '', $sitetemplate);
$sitetemplate=preg_replace('/<title.*?title>/si', '', $sitetemplate);


//Sangus: replace hrefs to point above catalog, but not the href for the style sheet! or http links!
$sitetemplate=preg_replace('/href="/si', 'href="../', $sitetemplate);
$sitetemplate=preg_replace('/href="..\/..\//si', 'href="../', $sitetemplate);
$sitetemplate=preg_replace('/href="..\/http/si', 'href="http', $sitetemplate);

//replace last bits: img src
$sitetemplate=preg_replace('/src="images/si', 'src="../images', $sitetemplate);
$sitetemplate=preg_replace('/<!-- START EMBED -->/si', '<!-- START EMBED -->', $sitetemplate);
$sitetemplate=preg_replace('/<!-- END EMBED -->/si', '<!-- END EMBED -->', $sitetemplate);

//creates bits for the had and the body
$sitetemplate_head = preg_replace('/<\/head>.*$/s', '', $sitetemplate);
$sitetemplate_top=preg_replace('/<!-- START EMBED -->.*$/s', '', $sitetemplate);

//replicats info fot the body tag atributes
preg_match('/<body([^>]+)>/', $sitetemplate, $sitetemplate_body_pre) ;
$sitetemplate_body = $sitetemplate_body_pre['1'];
$sitetemplate_body = preg_replace('/images/s', '../images', $sitetemplate_body);

//strips the head info from the body
$sitetemplate_top=preg_replace('@<head[^>]*?>.*?<body.*?>@si', '', $sitetemplate_top);
$sitetemplate_top=preg_replace("@,'images/@si", ",'/images/", $sitetemplate_top);

//strips the head info from the body
$sitetemplate_head=preg_replace('@</head>@si', '', $sitetemplate_head);
$sitetemplate_head=preg_replace('@<head>@si', '', $sitetemplate_head);[/PHP]
01 Aug 2006, 23:14
#2
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

sanguisdesign-

I really hate to sound lame, but after reading and re-reading your post - I have absolutely no idea what you are talking about. Nor do I understand what you're supposed to with the lines of code.

Any further info on what and how this works would be appreciated.

thank you,

Betty
02 Aug 2006, 14:42
#3
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

fair enough.
I tend to murder written communication.
what this is is a template program that make its very easy to add a zen cart to and existing web site. this is more for people who already have a look and feel that they like, and just want to stick zen cart into the "content' are of their site and have it surrounded but the rest of their site.
In example. Joe had a site a/ a few pages on it and he has a pay pal style shopping cart that lists all his products and has the normal add to cart & check out buttons (ie http://www.estesjewelry.com)
say the client want to upgrade to zen cart but does not want to loose her current layout. this template would make it very quick and easy for her to install ZC and then have her lay out wrap around the zen cart that just replaces the pay pal part of her site.
I know that one can do this by just copying an pasting things into the tpl header and footer, but once you do that one can not rely on Dream Weaver template files any more and when ever a Graphic designer, (who does not care to know php) makes and update to the whole site the Zen cart does not get updated until a developer goes and cuts and pastes things in again.
so this template program takes one file that has a
[HTML]<HTML>
<head>
</head>
<body>
<lay out top>
<zen cart>
<lay out foot>
</body>
</HTML>[/HTML]
set up and does all the cutting for you it also will redirect their links/images to work in a sub directory, via the above regexps.

I hope this is clear now what the bennifit is.
I will post the code as soon as I have a the time to make and unbranded version.

JOsh
02 Aug 2006, 15:44
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Easy embed template

Looks like a PayPal site ... so what was gained here? :blink:
02 Aug 2006, 18:05
#5
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

that was just an example of a site that had a paypal site, the rest of the upgrade was all for your imagination. sole of the site running the old embed template are.
llamafantics.com,
moosepaws.com,
delightsoftheearth.com,
hsrc.biz
cleverwares.com

the list goes on

JOsh
04 Aug 2006, 02:30
#6
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

sanguisdesign-

Thank you for the excellent explanation, I get it now !!

Sounds like a really nice addition. There are so many attractive eCommerce templates that currently cannot be used for Zencart. Hopefully this will enable us to give ZC a more updatred and unique look!

Thank you again for the explanation. Also, will you not be releasing the pre-1.30 version?

Betty
04 Aug 2006, 03:35
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Easy embed template

You may wish to look into why your zenid is remaining on all pages ...

That should really only be there on the first click and secure pages ... but not on every page ...

Could just be a simple configuration issue on your session settings or something ...
04 Aug 2006, 04:57
#8
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

Betty,
I thank you that you get it. really, I fell bad for the most part when I post things in forums. my skill w/ communication in general is not very good (in know I am adding the Geek stereo-type)
The reason that I am not realizing the pre 1.3 version is that I did no develop the fist version of the thing. I took it over from another developer who had gotten it from another developer. A lot of the code besides the regexps that is not there any more, was for all intents and purposes their's and w/ no way to contact them I did not want to give away their handy work.
Also the firm it was developed for has this idea that taking Open Source and changing it (a tiny bit) makes it theirs. The new versions is more of and inspired version then a updated copy, and it's all mine to give away.
BTW these reg exes work in almost any template setting. I have recycled them in Gallery 2 and Phorum.
But I must confess the real reason behind making this version release public.
I am in the future going to starting a project which I am thinking will be called Zen Cart on the Rails. in which I am going to be wrapping (and replacing in some cases) Zen cart in Ruby on the Rails controllers. That will be my new easy embed template. I hope that people can enjoy what I have doone here and uses it, and ultimately keep it going so that when need it again (for ver 1.4, on a non rails server) it is not be all dusty. yes I am useing opnen source for my onw selfish purposes.

Linda, is that zen Id thing a ver1.2.x thing accross the board? beacuse all these sites are 1.2.x. the template mod would not affect the stock ZC sessions settings that they are running.

Please forgive the rant it is late, I have had and over heated week and I guess one to many beers.

JOsh

PS. I may have time to release the next version for a week as I am on vacation next week, and am behind schedule due to (heat) illness.
04 Aug 2006, 20:58
#9
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

Thank you again Josh for the added information.

You communicate just fine! Could that be because I am a "geekette" and it reads good to me!

Enjoy your vacation and feel better. I'm subscribed to this thread so will be anxiously awaiting updates once you get in your R&R time.

Take Care,

Betty
05 Aug 2006, 16:15
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Easy embed template

When the zenid (session id) stays displayed throughout the site ...

1 there is a server issue

2 there is a configuration issue

3 there is a combination of both

The session id is ment to display in the least number of locations ...

When it is contantly present, something is out of wack and needs to be fixed ...
05 Sep 2006, 20:59
#11
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

ok its been about amonth I know but here it is.
let me know what you think

Attachment #558
07 Sep 2006, 07:46
#12
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

Hi Josh,

I downloaded your mod. and I have a couple of questions.

When you say you can create a template and insert Zencart into it, does that mean (for example) I could buy a template from a template site for a music downloads store (not built for a cart) and Zencart would take on the look of this site?

On the stylesheets, are they in addition to the Zencart ones or instead of?

Thank You,

betty
07 Sep 2006, 13:42
#13
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

When you say you can create a template and insert Zen Cart into it, does that mean (for example) I could buy a template from a template site for a music downloads store (not built for a cart) and Zen Cart would take on the look of this site?

what it means is you could buy said template and very easily make a copy of it (the html) and out zen cart in the content section of the template. in a lot of cases w/ sites that were done w/o a catalog initially can have a zc added in w/ out any big lay out changes.
SO the site would surround it.
As for it just taking on the look of the rest of the site that depends, on how the rest of the site looked. if it was made w/ good styles (CSS) you could expect a good amount of things to change, like the standard font and link color how tables and divs are handled.
one thing I should pint out is this template is no match for a good css tweaking afterwards, and a good Graphic designer to tweak your site this just makes it hell easier to maintain a consistent looking web site. it was made w/ dreamweaver designers in mind because if they just put the <!-- START EMBED -->, <!-- END EMBED --> in to a dreamweaver editable area in a dream weaver template file, then when ever they make up dates to the whole site they make updates to the zen cart as well.

On the style sheets, are they in addition to the Zen Cart ones or instead of?

instead of.
just unzip the contents of the .zip into you template directory and you have all the basics of the template.
in the zen cart back end select sang_embed as your template and start dong more tweaks.

does this clarify things?
07 Sep 2006, 17:33
#14
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

Yes it does Josh, thank you.


It will be a while before I can actually use it, but I will let you know how it came out and definitely will post any issues I have with it :blink:

It would also help if sometime you apply it to a non-live v1.35 site so we could peak at the source and see it in action. Kind of a visual how to.

thanks again,

betty
07 Sep 2006, 19:29
#15
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

It would also help if sometime you apply it to a non-live v1.35 site so we could peak at the source and see it in action. Kind of a visual how to.

well it is running on detoximin.com it live but there you go

JOsh
16 Sep 2006, 04:11
#16
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

Hiya Josh,

I'm having a bit of trouble trying to figure out how to install this and make it work.

In the brief instructions it says to put the full path to my template in the embed_config.php in the common folder. But how does the html template know where any of the embed files are and visa versa?

There is nothing that tells me where to put what, so instead the store has a funky looking template now with purples, yellows, etc. on it and nothing from the html file/template/pages.

thank you,

betty
16 Sep 2006, 04:35
#17
sanguisdesign avatar

sanguisdesign

Inactive

Join Date:
May 2005
Posts:
588
Plugin Contributions:
1

Re: Easy embed template

Bettysue,
I have a question, is the site that you are making suposed to only be a zen cart so that the ZC is in the root dir or is it a section of the site?
the reason that I ask is aloot of the regular expressions used in the config file are to make your template that is designed for links that notmal go to pages of the same level to go to links one folder level back.

In the brief instructions it says to put the full path to my template in the embed_config.php in the common folder. But how does the html template know where any of the embed files are and visa versa?

how does thos work you ask.
well it takes the file that you have poitned to and reads it in to thme memory.
then it goes through and loks for various patterns like the <body> tag, the <! START/STOP EMBED --> comments, or thins like doc type and strips them or modify them to work w/ the new directory.
it them looks for paqterns to splith the one big html template in to 4 separate varibles,
  1. the head information like javescript and style sheet links.
  2. stuff that goes in to the body tag like onload commands.
  3. body Mark up that goes before the zen cart
  4. body mark up that goes after the zen cart

then it just echos the varibles in the aproprate places.
It knows where the embeded files (I am assuming that you mena like incase and styles sheets, and moyby flash links) are becasue you put them in that template file.
please include a link tp ypu site nad of you would a link to the raw template file in your next post.
JOsh
25 Sep 2006, 19:02
#18
brain21 avatar

brain21

New Zenner

Join Date:
Sep 2006
Posts:
42
Plugin Contributions:
0

Re: Easy embed template

I have questions about the ZenCart Embed template that you have created.

My understanding is this:

1) I use the ZenCart to create all of my products so that they are in the database, etc.

2) I unzip all of the files into a ZenCart template file say /sanguis

3) I create an HTML (NON ZENCART) generic "template" file. Say it's called generic.html and uses the stylesheet generic.css For the code for the generic template page I currently have it setup like so:

<head> stuff (incl. javascripts, stylesheet links, etc.)</head>
<body>
Here is set the top of the page navigation, background images, etc.

<!-- START EMBED -->

Zen Cart stuff gets put here.

<!-- END EMBED -->

Here is the stuff for the footer of the page that I created in HTML, including footer navigation

</body>

4) I load the template file (the sanguis one), and point it to generic.html ??? Is that correct?

Does generic.html have to be in any specific directory?

I was not clear on your other post, does this setup preferr that the ZenCart files are in the root, or in a /store directory?

Now what I want from ZenCart is the product_info stuff, the shopping cart, shipping, & Payment modules. Basically everything BUT the initial homepage (setup currently as index2.html because index.html is nothing but a browser detection Jscript)

Is it possible to specify, or does the ZenCart stuff get embedded in EVERY file? Or does pointing it at generic.html simply create a new template file (or mod the /sanguis template file)?

Not quite clear in exactly how this all gets put together.

Thanks for any help!


Thanks,

Brain21/Alex F
25 Sep 2006, 20:22
#19
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Easy embed template

sanguisdesign:

Bettysue,
I have a question, is the site that you are making suposed to only be a zen cart so that the ZC is in the root dir or is it a section of the site?


The Zencart store is in a subdirectory off the root. The html files are in the root directory.

betty
25 Sep 2006, 20:39
#20
brain21 avatar

brain21

New Zenner

Join Date:
Sep 2006
Posts:
42
Plugin Contributions:
0

Re: Easy embed template

OK, this is what I did:

Created a generic.html file. Add the embed tags

unzipped the Sanguis embedded template and edited the 1 line to point to my generic.html file

Used the ZenCart admin to install the Sanguis template.

Now I navigate to the homepage and see that the stuff from the Generic.html is being used as a warapper. VERY cool!

OK, now what files got edited? IOW, how is this working?

I looked at generic.html and it seems unchanged. I looked at the files on the templates/sanguis_test directory (where I installed the Sanguis stuff) and those files (incl. tpl_main_page.php) look unchanged, as do the files in the template_default directory. I looked at index.php as well. No changes

So what file got changed and where? I would now like to do this to the other pages (other than generic.html). Do I run it once for each page, each time editing the sanguis embed_config.php file to reflect the path of each page? How exactly does this work? I also nedd to edit some paths & files on the "generic.html" page and the other pages. Which files do I edit, for things like loading different stylesheets for each individual page that needs a different one?

How would I say, create a product_info.php page in ZenCart (via adding items to the db) and then get that working within my pages? Would I open up one of these "embedded" pages and then just replace the code within the EMBED tags with the code from the product_info.php page that ZenCart creates, editing out banners as necessary? Seems to me like that is the way it works?

Getting closer...

Thanks,

Brain21