SID-00786: layout of page using TWiki shorthand
| Status: |
Answered |
TWiki version: |
4.3.2 |
Perl version: |
5.8.8 |
| Category: |
CategoryRendering |
Server OS: |
Ubuntu Linux 2.6.27.8 |
Last update: |
15 years ago |
Hello,
I am trying to figure out how to arrange elements on a page using the shorthand. The simplest example of what I mean is to place a table and an image side by side:
| this |
is |
| a |
nice |
| test |
table |
and <img src="test.png" />
By default, as one would expect they are placed on below the other. Is there any way, without using HTML to place them side by side? I have tried adding the elements in a table themselves using the shorthand but it ends up in a mess.
thank you for your help
Spiros
--
SpirosDenaxas - 2010-03-18
Discussion and Answer
Of course you
can manage layout with CSS, but in most cases I prefer to use borderless tables for their simplicity. But you can't nest tables without HTML, unless you use something like
BoundedTablePlugin.
But that might be overkill for a simple case like this. You could hide the HTML markup from your users with preference variables (define them site-wide, so that they will work in any topic). Something like this:
* Set STARTBLOCK = <table border=0><tr><td>
* Set NEXTBLOCK = </td><td>
* Set ENDBLOCK = </td></tr></table>
Then just insert those variable names around your other markup, like so (view raw version):
| this |
is |
| a |
nice |
| test |
table |
|
and <img src="test.png" />
|
--
SeanCMorgan - 2010-03-18
Different approaches:
1. You can place an image URL in a table cell.
2. Use img tag with align attribute, such as
<img src="test.png" align="right" />
3. Use div or table tag for page layout. Do that in raw edit, and enclose those tags in
<sticky> ...
<sticky> tags to prevent the WYSIWYG editor of messing around with it.
4. If you have a set of pages that share the same layout you could create a custom topic template, for example to show a sidebar to the right with images and other data that is generated dynamically. Learn about topic templates in
TWikiTemplates.
--
PeterThoeny - 2010-03-18
Thank you both for your feedback. I will give it a shot and let you know.
@Sean
Yep, I am trying in general to not use CSS/HTML so I can keep things "clean" for now - if I see that its just not possible to do otherwise, I can always use some simple tables to place things. Your suggestion is good though, I will try it out.
--
SpirosDenaxas - 2010-03-19
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.