Embed in an HTML/CSS web site/page.

Having trouble installing serendipity?
Post Reply
Cspahn
Posts: 2
Joined: Tue Apr 07, 2009 6:45 am

Embed in an HTML/CSS web site/page.

Post by Cspahn »

Hey all!

Real development newbie here so I apologize in advance for my lack of complete understanding and knowledge.

I am developing a basic website using Microsoft Expressions Web and hosting it on GoDaddy IIS7 with Php5.

There is no other php code on my site (I don't know how to use it). I had GoDaddy install the serendipity application into the ../blog folder.

I tried to understand what to do and found a site that I thought I understood. Here is what I have done.

1. Created file in ../blog directory named blog.php (this is my wrapper) here is the code:
<?php
ob_start();
require("index.php");
$serendipity_contents = ob_get_contents();
ob_end_clean();
require("../blog.php"); // The Container-File
?>
2. Modified settings in the admin site to set embed to yes; index file to blog.php; and gzip to no.
3. In ws_blog.htm (the blog page) I added the following to the content layer:
<?php
echo $serendipity_contents;
?>

Now when you navigate to the ws_blog.htm you get nothing in the content section. Any help would be sooooo appreciated!!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embed in an HTML/CSS web site/page.

Post by garvinhicking »

Hi!

Could you describe for what exactly you need the embedding mode? It was invented for Serendipity in really old versions. Nowadays, Serendipity is fully Smarty-templated, so you could easily edit the *.tpl files inside the templates/XXX/ directory (XXX is the name of the basic template you selected in the s9y configuration) to match your sites layout, even include potential header/footer files. This is much easier than any other integration.

Plus, you can't really use PHP inside .htm files in most common setups, only .php files are parsed with PHP uusally.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cspahn
Posts: 2
Joined: Tue Apr 07, 2009 6:45 am

Re: Embed in an HTML/CSS web site/page.

Post by Cspahn »

My site is developed using a dwt - dynamic web template. So all of the pages are built from that template. I do not know what a smarty template is nor how to use it in my site. Is there information somewhere that can describe what this is and how I would use it?
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Re: Embed in an HTML/CSS web site/page.

Post by judebert »

Sure, just check out http://www.smarty.net/.

In short, a Smarty template is HTML with some logic added. The Smarty logic is all surrounded by curly braces -- {} -- to distinguish it from ordinary HTML. Smarty can retrieve variables (using the dollar sign), conditionally include HTML based on a comparison (the {if} statement), and repeat HTML multiple times (the {foreach} statement, as well as several others).

The big advantage to Smarty is that it's a standard template engine, not just a Serendipity product. When you learn Smarty, you're learning a skill that you can use with other scripts. Other advantages are that Smarty is fast, easy to understand, and similar to HTML.
Judebert
---
Website | Wishlist | PayPal
claudermilk
Regular
Posts: 9
Joined: Sat Sep 06, 2008 3:55 am

Re: Embed in an HTML/CSS web site/page.

Post by claudermilk »

Right off the top of my head, I can see an issue. since your wrapper file is "ws_blog.htm", the extension ".htm" is telling the server it's a static HTML page, thus the php will not get executed properly. try renaming it to ws_blog.php or ws_blog.shtml (depends on the web server configuration).

I played with using that method, and ended up pretty much eliminating the wrapper file. In one site, I set up a new index page starting with the PHP code block as you showed. Much of the rest of the page is a standard page for the site with all the typical formatting. At the point in the page I want the blog to show up, I simply have:

Code: Select all

<?php
echo $blog
?>
...and the blog show up. In the admin config, my index page path is ../blog.php.

In another site, I found it easier to simply use the bulletproof template, and insert my site structure code into the index.tpl file at the appropriate locations. Then leave the admin setttings to defaults (index page is index.php, and it's not set as embedded).
ragebaby
Posts: 1
Joined: Tue Jul 07, 2009 4:44 pm

Re: Embed in an HTML/CSS web site/page.

Post by ragebaby »

Thanks claudermilk - very helpful!

I've embedded the bulletproof style into a webpage and it is working. The problem is that the serendipity blog is way too wide. I removed the width designations for the #wrapper in the default.css, but it didn't help.

The URL is: http://www.ragebaby.com/cblog/

Any suggestions?

Thanks a lot,
Joe
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Embed in an HTML/CSS web site/page.

Post by Don Chambers »

Looks like you are loading your root site's stylesheet after the bulletproof stylesheets. It also appears this same stylesheet has been copied to user.css - bulletproof's user-override stylesheet.... you have specifically set the width of the content area to 1020px.

I'm with others on this - I do not think this works well as an embedded installation... if you really love the HTML and css of your root site, you could actually build that into a new template.

Another alternative - one I would choose if this was my site - would be to power the entire root site plus the blog via serendipity, then use the cart software for your products... that would get you down to just two things to maintain (serendipity and the cart).
=Don=
Post Reply