TinyPortal

Development => Support => Topic started by: JOSHSKORN on September 09, 2007, 11:45:01 AM

Title: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 09, 2007, 11:45:01 AM
I tried to display the contents of an article in a script block, and it basically showed my article nd the rest of the webpage. How can I get just text only from the article?  I can't seem to find the answer on the site here, been searching all night.
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 09, 2007, 01:21:07 PM
Why don't you use the article block type?
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 09, 2007, 07:48:00 PM
Quote from: IchBinâ,,¢ on September 09, 2007, 01:21:07 PM
Why don't you use the article block type?

That worked, but here's the other thing.  What I'm trying to do, is have a fixed height on this box.  Do I modify the article to do this, and if so, how?
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 10, 2007, 03:05:59 AM
What have you tried to make it fit?
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 10, 2007, 03:33:34 AM
Quote from: IchBinâ,,¢ on September 10, 2007, 03:05:59 AM
What have you tried to make it fit?

I've tried this:

<iframe width="100%" scrolling="auto" height="400" frameborder="0" name="frame2">This is the text I went to display in my article.</iframe>


Results:  The block is completely blank.  Maybe it's layering the iframe on top of the text?
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 10, 2007, 04:08:16 AM
With that code you don't need an iframe. Just put the regular text in the article and then assign the article to the block.
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 10, 2007, 04:13:25 AM
Quote from: IchBinâ,,¢ on September 10, 2007, 04:08:16 AM
With that code you don't need an iframe. Just put the regular text in the article and then assign the article to the block.

OK let me explain what I'm trying to accomplish here.  The block size needs to have a set height.  This is why I wanted to use IFRAME in the first place, so I'd have my text, and then know how much space I would need to take up in my block with pictures, etc.
Title: Re: Display Article CONTENTS In a Block
Post by: Zetan on September 10, 2007, 09:37:33 AM
iframes are really for displaying external sites, info, pages.
Use a table instead.

Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 10, 2007, 09:50:25 AM
Quote from: Zetan on September 10, 2007, 09:37:33 AM
iframes are really for displaying external sites, info, pages.
Use a table instead.
Sorry I'm terrible at this stuff.  Can you show me how to do that? Sample code please?
Title: Re: Display Article CONTENTS In a Block
Post by: Zetan on September 10, 2007, 09:55:00 AM
No worries.. Google is your pal here  ;)

Search HTML Table Size:
http://www.angelfire.com/fl5/html-tutorial/tables/tablesize.htm

If you get really stuck, just found this:
http://www.bagism.com/tablemaker/
but I recommend you learn how tables actually work to be honest.
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 10, 2007, 10:18:02 AM
Quote from: Zetan on September 10, 2007, 09:55:00 AM

If you get really stuck, just found this:
http://www.bagism.com/tablemaker/
but I recommend you learn how tables actually work to be honest.

I was afraid of this.  Basically what's happening is, is that I've got 3 paragraphs.  I'm setting it to a height of 400, I intend on filling space somehow, with images, etc.  With the code generated from this site, my paragraphs look to be centered from top to bottom, and the spacing between paragraphs is huge.  Is there a way to fix this, for instance, cell alignment or something?  This is why I wanted to try to use an article first and set the article's height.
Title: Re: Display Article CONTENTS In a Block
Post by: Zetan on September 10, 2007, 10:27:27 AM
Well, at this stage for you, it's all experimental.
I've only just found that site myself.. and it looks very good. Wouldn't mind having the script that does that install on my site, in an Article.

If you scroll down the first page, there are explanations of what each parameter does.
Most browsers now can handle tables well.

Have a play with it. For ease of working with tables, always leave the border On (1).
This way you can see exactly what each table, cell is doing without doing it blind.
When you are happy with the result. Turn the border Off (0). Or keep it on.. up to you.
I have a border in one of my blocks with no block frame set. I often use tables to set a block height.

My site is down for now.
Title: Re: Display Article CONTENTS In a Block
Post by: Ken. on September 10, 2007, 01:35:42 PM
That table maker site is a great find Z... thanks.  :up:
Title: Re: Display Article CONTENTS In a Block
Post by: Zetan on September 10, 2007, 01:43:21 PM
Quote from: Ken on September 10, 2007, 01:35:42 PM
That table maker site is a great find Z... thanks.  :up:

I will have to bookmark it.. it seems useful if you are new to tables.. or just need to *cough* knock one up quick.
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 10, 2007, 11:27:19 PM
Don't get stuck on tables, they're on their way out the door lol. Seriously though, learn tables its a good thing to know and they will always have a use IMO.
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 11, 2007, 04:00:08 AM
Quote from: IchBinâ,,¢ on September 10, 2007, 11:27:19 PM
Don't get stuck on tables, they're on their way out the door lol. Seriously though, learn tables its a good thing to know and they will always have a use IMO.

Do you have any better ideas for me?  Basically I'm trying to do is a center block that displays an article BUT the catch is, I'd like a fixed height.  The article needs to display from the top.  Therefore, naturally you would see the bottom of the block with nothing in it, if the text doesn't populate the entire area.  I'm looking to basically set my height and add 'content' to the block as needed.
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 11, 2007, 05:52:14 AM
You've been given the perfect information on how to do this. Start with some code, and when you get stuck post your code so we can see. You will learn soooo much more doing this.
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 11, 2007, 06:01:32 AM
Quote from: IchBinâ,,¢ on September 11, 2007, 05:52:14 AM
You've been given the perfect information on how to do this. Start with some code, and when you get stuck post your code so we can see. You will learn soooo much more doing this.

OK here's my table approach, the one that has my text centered from top-to-bottom.  This is a scriptbox block.


<TABLE BORDER=0 WIDTH="100%" HEIGHT="400">
<TR>
  <TD>This is my first paragraph.</TD>
</TR>
<TR>
  <TD>This is my second paragraph.
</TR>
<TR>
  <TD>This is my final paragraph</TD>
</TR>
</TABLE>


Once again, I'm trying to set it up so it aligns everything top.
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 11, 2007, 06:04:39 AM
First tip, never use capital letters for HTML tags as that will not validate if you want your site XHTML compliant etc. A minor issue, but I just thought its something you should know. To align things vertically you need to add valign="top" to your table or td tags.
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 11, 2007, 06:25:12 AM
Quote from: IchBinâ,,¢ on September 11, 2007, 06:04:39 AM
First tip, never use capital letters for HTML tags as that will not validate if you want your site XHTML compliant etc. A minor issue, but I just thought its something you should know. To align things vertically you need to add valign="top" to your table or td tags.

Thanks for the tips.  Unfortunately, it's not working at all.  That is, the alignment is still centered vertically.  Can you show me what I'm doing wrong?


<table boarder=0 width="100%" height="400" valign="top">
<tr>
  <td>The first paragraph.</td>
</tr>
<tr>
  <td>The second paragraph</td>
</tr>
<tr>
  <td>The last paragraph</td>
</tr>
</table>



Click here (http://clansrv.crazynomad.net/thesite/index.php) for a visual.
Title: Re: Display Article CONTENTS In a Block
Post by: IchBin on September 11, 2007, 07:05:39 AM
add align="center" to your table tag if you want the content in the middle of the block. You probably need to add the valign="top" to the td tags instead of the table.
Title: Re: Display Article CONTENTS In a Block
Post by: JOSHSKORN on September 11, 2007, 08:07:13 AM
Quote from: IchBinâ,,¢ on September 11, 2007, 07:05:39 AM
add align="center" to your table tag if you want the content in the middle of the block. You probably need to add the valign="top" to the td tags instead of the table.

Well you were somewhat correct.  I came to the conclusion that because I was trying to have a table with a fixed height of whatever I specified, and because I was adding 'rows' for paragraphs, that it automatically was equally spacing out my text based on the height.  I guess some logical thinking does work at times. lol.  Take a look at my final code (obviously the display text isn't 'final' lol):


<table boarder=0 width="100%" height="400">
<tr valign="top">
  <td>The first paragraph.<br />
The second paragraph <br />
The last paragraph</td>
</tr>
</table>


I'll just add more 'br' tags to separate the paragraphs.  Thanks once again, Ichbin!  Thanks to my brain, too! lol
Title: Re: Display Article CONTENTS In a Block
Post by: Zetan on September 11, 2007, 11:29:45 AM
Table use for laying out entire websites is definately on it's way out.
Tables for simple layouts of content within pages, I'm assuming is not going anywhere soon.