 |
boardom b2 message board
|
View previous topic :: View next topic |
Author |
Message |
donncha
Joined: 18 Feb 2003 Posts: 43 Location: Cork, Ireland
|
Posted: Tue Mar 25, 2003 4:04 pm Post subject: b2-Smarty mod 0.3 released |
|
|
This is another major update. New features in this release:
1. Web browser installer script. Simply copy files into your b2-smarty dir and fire up install.php in your browser. (Almost as easy as that!)
2. Template editor now backs up changed template files. Up to 5 backups are made and each can be edited and restored very, very easily by clicking on a link.
3. Multiple themes. In the backend, click on "Template Changer" and click on the new design you want your blog to have! You can also create a complete backup of your blog template from this page, thus making it easy to try out new themes!
There's lots and lots of bugfixes. I seperated out as much content as possible from code so it should be possible to copy over src/* to the b2-smarty directory and if you want updated skeleton templates, and multiple themes simply copy over the contents of the "data" dir.
Can people test this and mail me if it's broken on your box? If you have a standard b2 install you should backup EVERYTHING. Backup your existing files, and make a dump of MySQL, just in case. Read the README, INSTALL and UPGRADE documents as this is a very different package to the original b2.
It's already running on http://blogs.linux.ie/ and you can sign up for a blog there and see all these wonderful things running already!
Source is available for download at http://cork.linux.ie/filemgmt/viewcat.php?cid=4 and I'd appreciate as many people as possible testing it, especially on Win32.
Since it requires Apache mod_rewrite, you'll have to have Apache installed, sorry!
Donncha. |
|
Back to top |
|
 |
eadz
Joined: 06 Apr 2003 Posts: 28 Location: Auckland, New Zealand
|
Posted: Sun Apr 06, 2003 1:30 pm Post subject: |
|
|
Hi,
I am making a blogging system ( http://gigablog.gigablog.com/ ) and I have used smarty.
Let me share some tips...
Tip 1 :
Use the db to store the templates :: makes it easy to use blogger.api template api :: http://smarty.php.net/manual/en/templates.from.elsewhere.php
Tip 2 :
Use blogger style tags :: improves security :: easier to write :: easier to use blogger templates :: use a str_replace like so :
Code: |
// WE DON'T WANT ANY smarty code sneaking in!!!
// this replaces the smarty opening and closing tags with lookalikes
// this means it's impossable to sneak any php into the template
$template = str_replace('~{{', '~((', $template);
$template = str_replace('}}~', '))~', $template);
// The non looping things
$template = str_replace('<$BlogTitle$>', '~{{$BlogTitle}}~', $template);
$template = str_replace('<$BlogSubTitle$>', '~{{$BlogTagLine}}~', $template);
// The blog entry loop
$template = str_replace('<BlogEntry>','~{{section name=i loop=$blogentry}}~',$template);
// Is there a new day? of so post the date
$template = str_replace('<NewDay>','~{{if $blogentry[i]->newday eq "true"}}~',$template);
$template = str_replace('<$NewDayDate$>','~{{$blogentry[i]->newdaydate}}~',$template);
$template = str_replace('</NewDay>','~{{/if}}~',$template);
|
I have also developed threaded comments. I like b2, and I would like to help impove it. Using smarty templages stored in the database, with blogger style tags, and enabling people to edit the templates with programs such as w.bloggar would go a long way to make b2 even better :) _________________
|
|
Back to top |
|
 |
donncha
Joined: 18 Feb 2003 Posts: 43 Location: Cork, Ireland
|
Posted: Sun Apr 06, 2003 2:06 pm Post subject: templates, db, blogger.. |
|
|
Hi eadz,
Excellent ideas but I have some reservations:
1. Security. I don't agree that using Blogger style tags will improve security over the use of Smarty tags. By default the security settings of Smarty are enabled in my project: http://smarty.php.net/manual/en/variable.security.php
2. I do agree that using Blogger style tags will make it easier to use Blogger templates, but there's probably copyright issues if a person were to mass-import templates. I don't discount the advantage of Blogger tags gives to template writers however. That would be a bonus.
3. AFAIK, bloggar.w talks to the web server through an xmlrpc interface. The actual implementation of the template system (be it filesystem or db) makes no difference to the remote application.
4. Using a database to store templates is tempting as the hit on the db will be minimal. It would require reworking of the caching system to include groups, so that blog content could be cached seperately from blog template. Currently when someone posts a comment, or updates their blog the cache is cleared and then regenerated on subsequent requests.
5. Using the database would increase security too, as the web server wouldn't have write access to the template files. Certainly worth considering this issue.
Thanks for your comments!
Donncha. |
|
Back to top |
|
 |
eadz
Joined: 06 Apr 2003 Posts: 28 Location: Auckland, New Zealand
|
Posted: Sun Apr 06, 2003 2:19 pm Post subject: Re: templates, db, blogger.. |
|
|
donncha wrote: | Hi eadz,
Excellent ideas but I have some reservations:
1. Security. I don't agree that using Blogger style tags will improve security over the use of Smarty tags. By default the security settings of Smarty are enabled in my project: http://smarty.php.net/manual/en/variable.security.php
|
Yes, that provides security.. and so does using blogger style tags. Ideally the higest security would be both If there are absolutly no varibles that are smarty->assign'd that you wouldn't want a user access to, then there isn't much risk.. but the other advantage to my approach, is you can use custom php functions, includes etc etc, but they are strictly defined including paramaters.
Quote: |
2. I do agree that using Blogger style tags will make it easier to use Blogger templates, but there's probably copyright issues if a person were to mass-import templates. I don't discount the advantage of Blogger tags gives to template writers however. That would be a bonus.
|
The main reason I use them is for people already familiar with blogger templates, and don't want to learn a more complex blogger template language ( smarty ). Gigablog won't work on straight blogger templates as there are many more functions that blogger doesn't have ( eg. comments ) so you couldn't mass-import templates. However, there are many great template resources on the web, and most require a link back ( aka linkware ) but they don't say "you can only use this on blogger" - quite often they can be used with MT, livejournal etc. The actual blogger.com templates aren't that good, and there are not that many of them. It would be a lot easier explaining what people have to do to use a blogger template with b2, than try and explain how to convert them to smarty.
Alternativly, this code could be used for a blogger style import that converts the code to smarty.
Quote: |
3. AFAIK, bloggar.w talks to the web server through an xmlrpc interface. The actual implementation of the template system (be it filesystem or db) makes no difference to the remote application.
|
Yes thats right, but using blogger style templates future-proofs b2 for when w.bloggar say can "preview" a template by actually putting entries on it. Or, there is a preview function ( store it in the db as a seperate record to preview, before actually saving it ).
Quote: |
4. Using a database to store templates is tempting as the hit on the db will be minimal. It would require reworking of the caching system to include groups, so that blog content could be cached seperately from blog template. Currently when someone posts a comment, or updates their blog the cache is cleared and then regenerated on subsequent requests.
5. Using the database would increase security too, as the web server wouldn't have write access to the template files. Certainly worth considering this issue.
|
Im not sure about the caching as I havn't looked into that, but if you're using smarty to cache the html output, then using a db shouldn't affect that.
Quote: |
Thanks for your comments!
Donncha. |
Eadz. _________________
|
|
Back to top |
|
 |
imatreeandurnot
Joined: 26 Sep 2002 Posts: 21
|
Posted: Mon Apr 07, 2003 7:24 pm Post subject: |
|
|
I may be too n00by-ish for this in the first place but,
When I install, I get no errors. But when I login I get:
Quote: | hello, you're logged in imatree
No Database Selected |
And when I try logging in over b2login.php I get
Quote: | Warning: main(/b2template.functions.php) [function.main]: failed to create stream: No such file or directory in /home/weeza666/public_html/testb2/b2login.php on line 4
Fatal error: main() [function.main]: Failed opening required '/b2template.functions.php' (include_path='') in /home/weeza666/public_html/testb2/b2login.php on line 4 |
Help? ;_; |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Tue Apr 08, 2003 1:47 pm Post subject: |
|
|
I don't know if you have figured this out or not..but please go to www.graphics-by-sara.com, click on tutorials, then on b2. There is an install guide. I also have one for how to create a MySQL database and user under CPanel.
This thread should be split, don't you think? And your post and mine should be put in the install help forum.
Sara |
|
Back to top |
|
 |
Candle
Joined: 23 Dec 2002 Posts: 547
|
Posted: Tue Apr 08, 2003 8:21 pm Post subject: |
|
|
Gadget Girl wrote: | I don't know if you have figured this out or not..but please go to www.graphics-by-sara.com, click on tutorials, then on b2. There is an install guide. I also have one for how to create a MySQL database and user under CPanel.
This thread should be split, don't you think? And your post and mine should be put in the install help forum.
Sara |
Have you tried to install this Sara ?
It is not the same installer as b2 ..And it does not work so far as I can tell ...as I have yet to see it installed on anything but the donncha site. _________________ My Game Forum
 |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1042 Location: Oregon
|
Posted: Tue Apr 08, 2003 8:46 pm Post subject: |
|
|
I personally don't like Smarty codes, because they are not as flexible as pure php codes. This was one of the reasons why I didn't like Blogger. _________________ Michael P. |
|
Back to top |
|
 |
Candle
Joined: 23 Dec 2002 Posts: 547
|
Posted: Tue Apr 08, 2003 9:07 pm Post subject: |
|
|
Cyberian75 wrote: | I personally don't like Smarty codes, because they are not as flexible as pure php codes. This was one of the reasons why I didn't like Blogger. |
Well so far as what i have seen i would have to agree with you 100% on that .
I have nothing against the b2 smarty , but it is just un useable in anything but a linux system and then i have some doubts .
The first installer just sets up the root users then you have to go to the next installer that installs the database etc .. and if you can't get pass the first installer you are going nowhere . _________________ My Game Forum
 |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Tue Apr 08, 2003 9:49 pm Post subject: |
|
|
Quote: | Have you tried to install this Sara ?
It is not the same installer as b2 ..And it does not work so far as I can tell ...as I have yet to see it installed on anything but the donncha site. |
Never mind, my mistake!
Sara |
|
Back to top |
|
 |
donncha
Joined: 18 Feb 2003 Posts: 43 Location: Cork, Ireland
|
Posted: Mon Apr 14, 2003 3:36 pm Post subject: b2-smarty, installation issues. |
|
|
Hi all,
I spent several hours yesterday trying to figure out some of the installation issues. Here's some tips:
1. Make sure register_globals is "On". You can apparently do this in a .htaccess file but that didn't work for me. I had to change the php.ini, YMMV. If you get an error message saying, "No Database Selected" then this is what's wrong.
2. After you unzip the b2-smarty tarball, copy all the files in the two directories src and data into one directory. That one directory should then have files like index.php, b2edit.php, AS WELL AS the directories skel, site-templates, in it.
I added checks for the above in the new installer and have it here with me in work, but I probably won't have time to make a snapshot release, so it may be tomorrow at the earliest.
Donncha. |
|
Back to top |
|
 |
Candle
Joined: 23 Dec 2002 Posts: 547
|
Posted: Mon Apr 14, 2003 4:59 pm Post subject: Sorry |
|
|
My register_globals is on .. allways has been from the start .so has to be something else . _________________ My Game Forum
 |
|
Back to top |
|
 |
donncha
Joined: 18 Feb 2003 Posts: 43 Location: Cork, Ireland
|
Posted: Tue Apr 15, 2003 10:17 am Post subject: More config stuff |
|
|
I may release a new snapshot later today if I find time to test it here at work. Here's a snippet from the updated INSTALL file on configuring Apache. Remember to restart Apache after you make these changes.
4. Your Apache httpd.conf must allow "mod_rewrite" and "Options" to work.
Look for the "Directory" directive for your webserver path. It'll look
something like this:
----------httpd.conf----------
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
----------httpd.conf----------
Change the AllowOverride line so it looks like this:
-----------Changes-----------
AllowOverride FileInfo Options
-----------Changes-----------
The FileInfo part allows mod_rewrite to work.
The Options part allows us to enable "FollowSymlinks" in the .htaccess file.
You could put the FollowSymlinks part in the httpd.con but then you may have to modify the .htaccess every time you upgrade.
If these changes aren't done, you'll get an error saying function "is_cached()"
is unknown. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2 © 2001, 2002 phpBB Group
|