hey, second post, bit later than intended.
Since last time i’ve been learning some html stuff using dreamweaver, which might have been a mistake. One of these things where you spend a while learning how to use an editor then spend ages saying “arhghh why won’t it let me do this simple thing?!?!” and wishing you’d just coded it all from scratch.
Current problem -doing my mocked up web page which has some ‘hard coded’ content, to show how the final page will look. I’ve imported a news page from the guardian web site into dreamweaver, added a table at the bottom for my different columns, put some sample comments in. What i want to do now is tag the comments and commenter names with a particular style, such as “comment_body” and “comment_name”. I’ve attached a style sheet with the above style names and some details like font size and colour. I thought i would be able to highlight the text and set it to be “comment_body” but no….the style just isn’t in the drop down list, which does have some styles from the guardian. Goddammit.
…reads some of “dreamweaver 8 for dummies” that i dl’d….
aha – when you make a new custom style (called a ‘class’) in a css, the name has to start with a full stop. Done that, showing up now in the style list, nice. Onwards…
OK, got my comment format now – so my rhtml code for each listed comment is going to look something like this:
<p><span class=”comment_body”><%= comment %></span>
<br/> <span class=”comment_name”> <%= commenter %></span> </p>
where ‘comment’ and ‘commenter’ are attributes in my DB.
The above will ultimately produce some output rhtml like this:
<p><span class=”comment_body”>Terrorism may take fifteen years to defeat, according to the UK government. Dream on.</span>
<br/> <span class=”comment_name”>-Phil, Eton</span> </p>
By the way, the span tag in html is used (eg inside a paragraph tag) to put elements on the same line. My comment and commenter name are both part of the same paragraph, but i want to use different styles, so i’m using the span tag just as somewhere to hook the ‘class’ attribute, that defines the style. That might not be the cleverest way to do this.
OK, simple so far, but acorns and that.
“acorns and that”, wow, am i a zen master or what.
One more thing with comments – i’d like to have comments that are a reply to another comment below the other comment and indented. In html, apparently, indents are done with the paragraph attribute, eg margin-left=”5em”; This works if i set a style with this attribute, and then format the text with that style, but it doesn’t work when i put it straight into the paragraph element as an attribute. Apparently paragraph formatting attributes are deprecated since html 4.01, i don’t know if that’s the problem. If it’s deprecated it should still work, right? Also, while in one of my previous tutorial web pages the whole paragraph is indented, when i do it in my proper one, which is inside a table, it’s only the first line of the paragraph that is indented. gah. Left that for now…
Next, the links – these consist of the up/down widget (using a placeholder dumb image for now), a link and a summary – the first 50 words of the article linked to, or something like that. The html for this is going to be something like this:
<p> <img src=”images/updown_arrow.jpg” width=”32″ height=”48″ align=”left”> <a class=”link_title” href=”http://news.sky.com/skynews/article/0,,30100-1273090,00.html” >Burning Car In Airport Terminal |Sky News|UK News</a><br/>
<span class=”link_text”>The UK is now on “critical” alert – its highest terror threat level. Police say the attack is linked to the two car bombs that were found in the heart of …</span> <br/>
<span class=”link_poster”>posted 5 minutes ago by mitch_mitchell </span> </p>
So, we’ve got several new data items here:
- link_title (which consists of a displayed text string and a url,
- link_text, which is just some text. The link text could be harder than it looks – what i’d really like to do is pull some text out of the ‘meaningful’ block in the page body, but this block will be labelled and formatted differently in different sites. Digg gets round this by making people put their own summary of the page they’re linking to – i might have to do something like search for the largest block of text and then use the start of that. Another problem is that a lot of pages don’t actually have the text, they have code to generate the text from somewhere else. Maybe i can get at the generated text though.
- poster (omitted if it was grabbed automatically)
- time since it was posted