Categories > TinyButStrong general >

design question

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: RwD
Date: 2003-11-26
Time: 12:14

design question

I'm trying to make a site for a company and they need to be able to controll the content of most of the pages without needing to change any template or files on the server.

So I am trying to figure out how to make one page that can be called in a standardized way being able to display custom data...

so for example, two calling links could be (can have any argument)
page.php?id=324 and page.php?id=346

resulting in:
<h1>example 1</h1>
blah blah blah blah yada yada yada

and

<img some img> This is the iamge of blah die blah
<h2>test</h2>

But if possible I would somehow control parts of the markup
Please remember I use seperate language tables, so text data could be seperated from the markup if possible.


Is it possible to have a system that lists bits that belong to a certain page and which template they should be merged with (and in what order they appear on the page).
Perhaps even a master template for the site that could call subtemplates that could merge with data????
And have this administrated in some sensible way

I hope this make some sense to you...
By: RwD
Date: 2003-11-26
Time: 12:16

Re: design question

forgot to mention that I do not want the literal markup stored in the database, it is ok to have "blah <b>blah</b>" stored in the text, but it shouldn't get much worse then that. I still need to be able to do this x-lingual :D
By: Skrol29
Date: 2003-11-26
Time: 12:28

Re: design question

Hi Rwd,

I'm not sure to well understand.
Can we have another exampe?
Is it about showing several articles with makup information?

If the data and the makup are separate, what kind of makup do you allow? Do you want makup to be separated from the data because those who write the text know nothing about Html?
By: RwD
Date: 2003-11-26
Time: 23:40

Re: design question

The ones who wirte the text don't know even the slightest thing of html.  But I found this free object that does wysiwyg editing of data content, so in that way the users can make bold text or whatever they like....


What I 'envision' is that th users can choose to (for example) add a new page. then add "parts" to that page like the "Part" Textwithheader or a part called Announcement (suppose an announcement will look different from TextWithheader.

But this is only an idea, and I do not know the best approach to making a generic way for building pages when also using TBS

I hope you now know what I mean?
By: Skrol29
Date: 2003-11-27
Time: 13:59

Re: design question

Well, it seems to me that it shouldn't be so difficult to do.
If I undserstand, you'd like do build a kinf of document manager.
Documents are articles made of texte and some makup tags.

First you have to choose whether the documents are saved in a database or in texte files.
Then, you have to imagine your own makup system like we often see in some web forums. It may begins with something very simple like tags <b>,<i>, <color>,....

After that work, the rest is a common web application.
By: RwD
Date: 2003-11-27
Time: 15:08

Re: design question

I will not use my own markup. I will be using a wysiwyg object on the site for normal html tag editting...

The pages must be stored in the database, I identify ehm with an id, those id's are unique per language table.

So I have 1 or more text tables per language, and that number times the number of languages supported.


What I need is a way of having the user define the type of document so I can apply templates or something similair...


If you go to http://www.cornelco.nl and open the part called "Informatie en services" Then you will be able to open pages that are all generated with the same script.
Big drawback here is that for example the "Nieuws" page looks differen in lay-out because I could not define a standard way of doing this. Templates can, but I need as much flexibility as possible!!
"Maillist" Is an example of a page that looks completely different from the others, but it was still generated by the same page (calling a different script)

What I would like is a way that will keep everything flexible but standardized. So a text can have a header, and if it does it is positioned like this and that blah blah...

I could try to explain even better, but I am at work now, no real time for that :(
By: Skrol29
Date: 2003-11-27
Time: 15:29

Re: design question

Ok, I undsertand better now, I think.

This is quite easy to to I think.
With TBS, you can use sub-templates easyly.
You can also have a subtemplate wich execute a corresponding script in the same time.

For example, you can have a table with the following fields :
pg_id (int), pg_body (text), pg_template_id (int)

Assuming that you have those data into Php variables such as $pg_id, $pg_body, $pg_template_id ; then you can build a main template with the following TBS field somewhere int it :
[var.pg_template_id;file=subtemplate_[val].htm]

If you want to include this file automatically when the main template is loaded, you can use :
[tbs_include.onload;file=subtemplate_[var.pg_template_id].htm]

If you want to execute an external PHP script when the sub-template is added, you can use :
[var.pg_template_id;file=subtemplate_[val].htm;script=subscript_[val].php]
This will suppose that the corresponding script exists. In the coming version, there is a new parameter than enables you to avoid error message if the corresponding script doesn't exist.

If you want to execute a PHP user functionwhen the sub-template is added, you can use :
[var.pg_template_id;file=subtemplate_[val].htm;onformat=subfunction_[val]]
This will suppose that the corresponding function exists. In the coming version, there is a new parameter than enables you to avoid error message if the corresponding function doesn't exist.

I hope this will help you.
By: RwD
Date: 2003-11-28
Time: 09:12

Re: design question

That might work per subtemplate. But then how do you suggest storing information on which parts apear on a page. So, how do you determine which parts&subtemplates are needed for a page.

suppose the currently asked page has the following parts
*header 1
blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah
*header 2
1.  blah blah blah blah blah blah blah blah blah blah
2.  bloh bloeh blie blo bluh bleeeh blich blac
3.  blahdieblah die blah die blah bleh ayah
blah blah blah
Some text here as well.....
these are stored in the database like:
$pg_title = "header 1";
$pg_body = "blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah";
$pg_template_id = "text_with_header.htm";
$pg_title = "header 2";
$pg_body = "blah blah blah blah blah blah blah blah blah blah
bloh bloeh blie blo bluh bleeeh blich blac
blahdieblah die blah die blah bleh ayah";
$pg_template_id = "ORDERED_text_with_header.htm";
$pg_title = "";
$pg_body = "blah blah blah
Some text here as well....."$pg_template_id = "plain_text.htm";

templates:
text_with_header.htm: displays the text, and places the title var into a header
ordered_text_with_header.htm: displays the text and a header. but also replaces every linebreak with </li><li> (and <ol><li> at the start) creating a ordered list...
plain_text: nothing fancy, just the text



If this is what the seperate parts look like, how could I best store the page information for a page that has al three of the above mentioned parts on it?


(so the endresult would be like this:)
*HEADER 1
blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah

*HEADER 2
1.  blah blah blah blah blah blah blah blah blah blah
2.  bloh bloeh blie blo bluh bleeeh blich blac
3.  blahdieblah die blah die blah bleh ayah

blah blah blah
Some text here as well.....
By: Skrol29
Date: 2003-11-28
Time: 16:42

Re: design question

In you example, the three presentations are very similar.
Enought similar too not use sub-templates.
But let's do it with sub-template.

1/ In the main template, you can create a simple block that will insert the conveniant sub-template for each record :
<table><tr><td>[b1.pg_template_id;file=[var];block=td]</td></tr></table>

You have to take care that the field 'pg_template_id' has to be the first column returned by the query. This is because TBS is not (yet) able to well manage with bloc's fields nested together :|

2/ The sub-template are defined like this :
- text_with_header.htm
*[b1.pg_title]
[b1.pg_body]


- ORDERED_text_with_header.htm
*[b1.pg_title]
[b1.pg_body;htmlconv=no;onformat=m_ordered]

m_ordered() is a function that convert the value into HTML and replace the breaklines with <li> tags. Its syntaxe is defined is the TBS manual.
If you don't want to have this function in you main program, you can use the  'script' parameters instead of 'onformat'.

- plain_text.htm
[b1.pg_body]
By: RwD
Date: 2003-11-29
Time: 01:38

Re: design question

but my question was how I can safely store which parts belong on which pages.
By: RwD
Date: 2003-11-29
Time: 13:21

Re: design question

By the way, suppose we don't take the approach I suggested, what would be your suggestion to do this?

(I still haven't made up the final plan on doing this)
By: Skrol29
Date: 2003-11-29
Time: 15:55

Re: design question

Isn't the
  pg_template_id = "text_with_header.htm"
enought to manage wich part goes where?

Maybe I missed something about the organisation of one page.
By: RwD
Date: 2003-11-30
Time: 14:13

Re: design question

that doesn't really say which part goes where
say you have parts 1, 2, 3, 4, 5, 6, 7 and 8

Page 1 consists of parts 1,3,7 and 4
Page 2 consists of parts 2,5,6 and 4
Page 3 consists of parts 8 and 6

There is nothing controling that mechanism.

but besides from this method, Is there do you think another one?
------------
something else came up by the way :D

http://www.solmetra.com/en/disp.php/en_products/en_spaw/en_spaw_about

Seems pretty good, I can define styles with this thing making sure a table is a table and so on. But then I'm wondering about the template engine how will these things work together?????

Doesn't the SPAW editor kind of ruin the idea of templates???
By: Skrol29
Date: 2003-12-01
Time: 01:28

Re: design question

>Doesn't the SPAW editor kind of ruin the idea of templates???

I'm discovering Spawn. It's very interesting and it is free!!
But it seems to me that it has not so much to do with templates. Even if it's probably an interesting tool to perform one of your needs : to enable users to enter Wysiwyg articles.

>Page 1 consists of parts 1,3,7 and 4
>Page 2 consists of parts 2,5,6 and 4
>Page 3 consists of parts 8 and 6
>There is nothing controling that mechanism.

In my point of view, controling which part has to go on which page is not the job of the template but more the job of the database.
In your application, when an article is entered, who decides in which page it will be available? Answering this question will help to build the table structure, in order to nest info for displaying wanted articles in wanted pages.

>but besides from this method, Is there
> do you think another one?

I feel like I've missed something about your application.
Do you want the users to enter they own articles with the look they want (headers, orderd lists,...), or with one of the look you've prepared?

If it's the look they want, the better solution is to do something like the "new post" window of this forum. The user enter a text with some special tags where they want. You just have to check the tags coherence before to save the article, eventually display a preview. Then, before to display the article, you convert special tags into Html tags.

If it's one of the look you've prepared, you can use the solution I just wrote in the previous post. You can make it more simple by using an event function instead of sub-template.



By: RwD
Date: 2003-12-01
Time: 07:40

Re: design question

Well, I want it to be in the style I prepared, for that I want to use css.
But I would also like them to be able to use SPAW.

So what I want is them to use SPAW, but also use my styles at the same time!

SPAW runs on javascript for the most part. and some closer looks show it is actually close to the techniques I already use to display the entire site with :)  But the reason I mention the javascript part is because this means I control the tags, what can be done and what not.