BBC Options for News?

Started by gbsothere, September 21, 2009, 08:32:32 PM

Previous topic - Next topic

Arantor

Good start :)

The reason they're disabled is because you're missing the Javascript that gets included too. The problem with said JS is that it's geared to a given textbox with a given name - and on the news page you can have multiple entries.

gbsothere

This is literally me, right now---------> 




I don't suppose you'd want to take a look at my ManageNews.template.php file would you? 

I brought my sign...




:D
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

I wouldn't know where to start to be honest; I know it's driven from editor.js but I don't know any more than that to be honest.

gbsothere

Do you think we should move this to Coding Discussion to see if anyone knows how to plug this thing in and make it run?   :)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor


gbsothere

Thanks, Arantor!   :)


If any coder who wanders by feels like helping an old man out...   

Would you take a look at the attached ManageNews.template.php (this one is for 1.1.10) and help me figure out how to make these BBC buttons and pulldowns over the News input box interact with it?  (I realize that the option "Click here to add another item" produces yet another input box, so that might complicate things.)  Right now, although the pulldowns reveal the proper font faces/color/size, these are all disabled.   :(





We use our news fader quite a bit and incorporate things like images, colors, URLs, etc.





Right now, we have to manually type in BBcode for everything.





  This is why I'm hoping to make these buttons active. 

Any help would be much appreciated.   :)


My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

SAFAD

Yea
The Signature are bbcode may help you
Arnator Go For IT x)
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

gbsothere

I can't get the javascript to "marry" the BBCode buttons and the text input area.

I think it's because, as Arantor pointed out earlier, the News input area is different from, say, a regular post box, because it has the option "Click here to add another item", which renders yet another input box. 

I was looking at the page source of the News area and saved that as an index.php file (attached below).  This bit of code from it references the input box:

<tr class="windowbg2">
<td align="center">
<div id="moreNewsItems"></div><div id="moreNewsItems_link" style="display: none;"><a href="javascript:void(0);" onclick="addNewsItem(); return false;">Click here to add another item.</a></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
document.getElementById("moreNewsItems_link").style.display = "";

function addNewsItem()
{
setOuterHTML(document.getElementById("moreNewsItems"), '<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="news[]" style="width: 85%;"></textarea></div><div id="moreNewsItems"></div>');
}
// ]]></script>
<noscript>
<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" style="width: 85%;" name="news[]"></textarea></div>
</noscript>
</td>
<td colspan="2" valign="bottom" align="right" style="padding: 1ex;">
<input type="submit" name="save_items" value="Save" /> <input type="submit" name="delete_selection" value="Remove selected" onclick="return confirm('Are you sure you want to delete the selected news items?');" />
</td>
</tr>
</table>
<input type="hidden" name="sc" value="85ea2ae92e4c87b22f54afae7a000ec4" />
</form>
</td>
</tr>
</table>


I wondered if either the tr class or the div id could somehow be referenced in the javascript to create a relationship between the BBCode buttons and the text areas.

:-\
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

OK, let me explain how it works - and why on a second glance it might not be so bad if I can dredge up the knowledge of how to do it.

When you have an HTML form you have to supply names for each element. But since you can't have multiple elements the same name, you're a bit stuck. Thus there is the array variant.

As you can see from that source, news boxes are <textarea> with names of 'news[]'. This means the first one is news[0], the second news[1] and so on.

If you were to trigger an event on selecting the box to say 'the current one is box n', then have the Javascript directed there, it becomes possible - but it's a clone of the editor.js file with tweaks.

gbsothere

Would setting a limit (albeit, a generous one) on the number of allowed news entries make it any less complicated, rather than the implied "infinite" number allowed?   Or is that really not an issue? 


My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Would make no different to the code at any practical level.

There are limits - several of them - but you're never liable to actually hit any of them.

gbsothere

*heavy sigh*

This stuff seems like rocket science. 



Thank you for explaining it, Arantor.  I'll light my pipe and mull it over and hope for comprehension to dawn. 

:)

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

I love it when people compare things to rocket science; having actually built rockets in a science class (which was actually entitled, "So you think you're a rocket scientist?"), I can say that programming in PHP is actually easier.

Just to clarify on the limits:
I don't think there is an implicit limit on the number of items you can have referenced with news[]. If there is, it'll likely be in the order of 32767. Your mileage will vary depending on browser.

There is, however, a direct limit on news items.

For those who don't know the mechanics, all of the news articles are actually chunked together into a single row in the smf_settings table. Line breaks in the entries themselves are converted to <br />, then it's stored as one 'line' per news entry in the database.

The limit is that there is a total of 65534 characters available for this field.

gbsothere

With regard to rocket science and PHP, here's what an odd fellow I am:  I know absolutely nothing about rockets and the only reason I stumbled onto this web site is simply that I'm an old retired guy who's trying to host a little forum.  And yet, without exaggeration, I can tell you that I leave the television tuned to the NASA Channel all day long and have never missed a shuttle launch/landing/docking, space walk....   and while all this is going on in the background, I sit and stare at the SMF files as if I'll "crack the code" if I don't blink.   *grin*  I know nothing about either and yet I'm equally fascinated by both. 

:D

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

SAFAD

@gb i didn't understand anything but i  like comparation with rocket sience to just like i feeel i can build a rocket :)
i have few things to do
so you have to wait me a little then i start working on it
regards
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

The problem with SMF code is that if you're not experienced at PHP, it feels like a wall of code.

Even when you are experienced, until you can start chipping away at it it's *still* a wall of code, but that's true for any sufficiently large machine.

gbsothere

This, alone, justifies the existence of a test forum....   or several of them.   :)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

I currently have four on my local PC :) though in varying stages of breakage...

gbsothere

Quote from: Arantor on September 24, 2009, 08:43:34 AM
I currently have four on my local PC :) though in varying stages of breakage...


I'll try to look at it as Beta-Testing:   "Try to break it." 

Off I go, to give it the old college try.   :D
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Arantor

Oh, I'm very good at breaking it; I probably get a whitescreen error on 1 in 3 mods I write because I've missed something.

I think this is getting a little offtopic though.

Please feel free to play with it and I'll see if I can dig something out of this (my JS is not as hot as the SMF dev teams')

Advertisement: