Touble feeding more than one rawcss to the aI() function

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
restromania
Beginner
Beginner
Posts: 4
Joined: Sun Jul 29, 2007 1:52 pm

Touble feeding more than one rawcss to the aI() function

Post by restromania »

Hello!

I'm having a big problem feeding more than one rawcss parameter to the aI() function.

It's a pretty simple problem really, the aI is only taking one parameter:

Code: Select all

   aI("rawcss=margin-left:11px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);   
If i try multiple rawcss or a "normal" string of parameters, then nothing happens. Just doesn't work:

Code: Select all

   aI("rawcss=margin-left:11px;rawcss=letter-spacing:-1px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);  

or, even perhaps less likely to work:
aI("rawcss=margin-left:11px;letter-spacing:-1px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);  

It just seems sort of wierd or perhaps an oversight that rawcss can only handle a single set.

I mean, yes, of course I set up the rawcss string just fine in the style for that menu, that's not a problem:

Code: Select all

 ...
fontfamily="Verdana";
fontsize="8pt";
fontstyle="normal";
fontweight="bold";
decoration="none";
rawcss="font-weight: 700;letter-spacing:-1px;word-spacing: 88%;line-height:88%;text-align:left;margin-left:46px;margin-right=6px;margin-top=0px;margin-bottom=0px;";
...
It's just that when you send that only-one-allowed single rawcss for the aI() function, it cancels out all of the other rawcss declared in the style for the menu, which is, forgive me, a bit silly.

Any chance of a fix? Or am I missing some syntax here?

I could only suggest that the syntax for Milonic change for aI() to something like:
aI("rawcss=attribute:value,attribute2:value2,attribute3:value3;text=textvalue;");
You can see my floating side menu at http://www.restromania.com/passports for example.

Thanks so much!

David Ciobanu
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I'll post this to Milonic. But, one thing I note is that in an aI string the menu uses ; between parameters, i.e. text=;url=; and so on, so if you need to use the semi-colon because you want more than one rawcss parameter wouldn't you have to somehow 'escape' that? I am not saying this will work, I was only wondering.... js is not my thing :)

Ruth
restromania
Beginner
Beginner
Posts: 4
Joined: Sun Jul 29, 2007 1:52 pm

Ruth is Rather Clever!

Post by restromania »

Thanks very much Ruth, it worked like a charm. You really are quite clever, it never occured to me to put a %3B instead of the ";" inside that one. I guess that will work for anything which needs multiple parameters then! GREAT!

I've now put for the rawcss string as follows for that aI() :

Code: Select all

 aI("align=center;rawcss=text-decoration: none %3B letter-spacing: 1px %3B margin-right:14px %3B margin-left:2px %3B margin-top: 0px %3B margin-bottom: 0px %3B ;text=<span class=flT12>" + showText + "</span>;url=#top;itemheight=28;title=See Navigation Below!;bgimage=SideTitleLink.png");
Notice that tags like <span>, <h3> and others work just fine. I use <span class=XXX> to control via a CSS the appearance of individual menu items.

You can see the results of YOUR GREAT TIP now at http://www.restromania.com/danubedelta!

THANKS SO MUCH, you're a treasure to Milonic!

David Ciobanu
restromania
Beginner
Beginner
Posts: 4
Joined: Sun Jul 29, 2007 1:52 pm

Oh wait, no...

Post by restromania »

Oops, no, that %3B doesn't actually work, I spoke too soon, sometimes just the first one works with that, and I foolishly didn't test thoroughly :cry:

Anyways, I did get control of individual menu lines by using:

Code: Select all


For the menu title (at the top of the vertical floating menu):

     text=<div class=menutitle>MENU TITLE HERE</div>; 

and then for other items, something like: 

     text=<div class=menuitem>Menu Item Here</div>; 

 
That works just fine and is a good workaround for the single parameter rawcss problem when u need to maniuplate the menu item text appearance on a line-by-line basis.

You can see i did the top line as big bold white, and the rest of the sections and menu items in slightly different fonts at http://www.restromania.com/

Ruth, thanks again for the help!

ENJOY!

David Ciobanu
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

You should (I think) be able to just double up on the ; at the end of the rawcss definition; e.g. -

Code: Select all

aI("rawcss=margin-left:11px;letter-spacing:-1px;;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);
Note the ;; after the -1px. This is the same method used after something like a & item. If it's at the end of a definition it needs to be &; to continue with other items in the aI string.
John
restromania
Beginner
Beginner
Posts: 4
Joined: Sun Jul 29, 2007 1:52 pm

The Double Semi-Colon is the ANSWER!

Post by restromania »

Bingo John. Worked great, very smart of you to make that connection.

Code: Select all

aI("rawcss=text-decoration: underline;color: #0033CC;margin-left:27px;;itemheight=20;text=menutexthere;... ");
The double semi-colons worked great. We also use Romanian characters like "UPPER ARGE & # 3 5 0 ; " (the code makes an "s" with a cedilla on it) and in links for the url= tag such as "#Upper_Arge & # 3 5 1 ; _River_Region". (i had to put spaces in the codes to prevent the phpBB from translating to the real characters!!!).

Thanks to your tip John, I have simply replaced the semicolons with a double, which makes all of our special characters (such as "ă Î â ş ţ", called diacritice in Romanian) work just great!

Code: Select all

url = ReplaceAll(url,";",";;");
text = ReplaceAll(text,";",";;");
Anyways, I strongly suggest that Milonic immediately include the double-semicolon trick in it's documentation. It's useful for both special characters used in menu items, as well as for multi-parameter properties for the aI() function.

Enjoy, and thanks again!

David
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

^5 John.

I knew it has something to do with semi-colons but I would never have thought of the double after the rawcss parameter :)

Ruth
Post Reply