Log in

No account? Create an account
07 August 2005 @ 04:02 pm
Trying to get the hang of coding Component (S2)  
Obligatory disclaimer - yes, I have spent the last several hours reading the tutorials. In that time I've managed to create user and theme layers, activate a style using them, and start coding those layers by pulling down the code created using the wizard.

My test journal is at http://test.livejournal.org/users/theredhead1/

The style and layers is question are style ID #5642, user layer ID #6632, and theme layer ID #6633 (which have been made visible for your convenience).

But quite obviously I'm missing a connection regarding modifying stylesheets (specifically in regards to print_custom_head and the spiffy date format).

So I tried to stick the stylesheet stuff in. I've included the lovely code from one of the tutorials here, as since it won't compile it's not saving to the layer. I just tried putting it on the end to of what I currently have in the user layer ( appropriate "{" & "<"changed to "[" for viewability here):

#*******Stylesheet code*******

#keep first lines

function print_stylesheet() [

#stylesheet additions & changes here

#spiffy date & time

function Page::print_custom_head() [

*"""[style type="text/css"]

*line-height: 36px;
font-family: serif;
font-size: 80pt;
color: #f9a861;
letter-spacing: 10px;
text-align: center;

line-height: 10px;
margin-top: -19px;
margin-left: 170px;
font-family: serif;
font-size: 10pt;
color: #ffe3c6;
letter-spacing: 5px;
text-align: left;

line-height: 10px;
margin-top: 8px;
margin-left: 285px;
font-family: serif;
font-size: 10pt;
font-weight: 700;
color: #ffe3c6;
letter-spacing: 2px;
text-align: left;


#keep last lines


Here are the less than lovely results:

S2 Compiler Output at Sun Aug 7 13:56:33 2005
Error compiling layer:

Compile error: line 93, column 44: Unexpected token found. Expecting: [TokenPunct] = (
Got: [TokenIdent] = type
S2::Node, S2/Node.pm, 139
S2::NodeArguments, S2/NodeArguments.pm, 25
S2::NodeTerm, S2/NodeTerm.pm, 450
S2::NodeIncExpr, S2/NodeIncExpr.pm, 41
S2::NodeUnaryExpr, S2/NodeUnaryExpr.pm, 40
S2::NodeProduct, S2/NodeProduct.pm, 28
S2::NodeSum, S2/NodeSum.pm, 31
S2::NodeRelExpr, S2/NodeRelExpr.pm, 41
S2::NodeEqExpr, S2/NodeEqExpr.pm, 29
S2::NodeLogAndExpr, S2/NodeLogAndExpr.pm, 29
S2::NodeLogOrExpr, S2/NodeLogOrExpr.pm, 29
S2::NodeRange, S2/NodeRange.pm, 29
S2::NodeCondExpr, S2/NodeCondExpr.pm, 29
S2::NodeAssignExpr, S2/NodeAssignExpr.pm, 29
S2::NodeExpr, S2/NodeExpr.pm, 29
S2::NodePrintStmt, S2/NodePrintStmt.pm, 48
S2::NodeStmt, S2/NodeStmt.pm, 35
S2::NodeStmtBlock, S2/NodeStmtBlock.pm, 42
S2::NodeFunction, S2/NodeFunction.pm, 104
S2::Layer, S2/Layer.pm, 58
S2::Compiler, S2/Compiler.pm, 27


89: #spiffy date & time
91: function Page::print_custom_head() [
93: """[style type="text/css"]
95: .date4{
96: line-height: 36px;
97: font-family: serif;

So what am I missing here? I know the code works (obviously). It's clear to me that I'm somehow not putting this code in my user layer correctly, or am missing some other vital ingredient. Also, is there any way for me to access/download my current stylesheet so that I can see what's going on? Help?


-the redhead-
Brown Eyed Girlbrowneyedgirl65 on August 7th, 2005 11:50 pm (UTC)
'k...first off style stuff is defined with curly not square brackets.
for example

secondly, there's a *very* helpful community called components_help...
oh...I see you've already posted there *grin*. Well anyway, that's the first problem. The second, for ppl to see your layer, is to put

layerinfo "source_viewable" = 1;

at the top of your new theme, then people can look up your layer info, you would give an id like
and people could see what you've been doing. (Obviously, your ID will be different from mine, just look at the top of your browser while you're editing your theme and copy that url into your question and ppl can then look at it.)

Anyway you've doubtless gotten a ton of responses already, so happy coding! It's been fun over here the last two weeks as I've started the same kind of project (oy...was just gonna add a few style def'ns...ha ha ha ha ha...it sucks you in...watch out...eeeeeee)

-the redhead-theredhead on August 7th, 2005 11:55 pm (UTC)
Yes, I know about brackets. As I said in my post, the "["s are so the code would show up in my posting *smile* And yes, I already posted over in components_help.

Unfortunately, it's still not working. Care to show your code so I can see an example of this all working together? It might give me a better clue than the tiny little clues people seem to want to give out.

-the redhead-
-the redhead-theredhead on August 8th, 2005 12:03 am (UTC)
Oh, and I had already made my layers visible and given the IDs in my original posting as well.

I posted in your journal earlier in the week that I think the different colored quote box you came up with was pretty spiffy - how did you do that?

-the redhead-
...still plugging away at this customization thing...
Brown Eyed Girlbrowneyedgirl65 on August 8th, 2005 12:23 am (UTC)
oh, *blush* sorry 'bout that on the square brackets. Actually, the link I posted shows you my code, if you go and look at it. As for the quote, if you look for the print_free_text function in my code, you'll find it there. I keep meaning to split that out into its own function. Only thing to watch out for, if you see $mv.cleargif, look near the top of my theme for those definitions (and probably just substitute that long string for it instead of trying to set up the class the way I did, unless you understand what it is that I did). I'm a programmer, what can I say *grin*. But I got the random quotes straight out of the tutorial on components help, the main thing is that I set the rounded corners to true, which makes the colors different. not intentionally, actually, but I like the effect too.

I'm heading out shortly, but I'll look at your code later tonight or tomorrow morning. Although, kunzite1 on component_help is usually very quick and *very* helpful.
-the redhead-theredhead on August 8th, 2005 12:28 am (UTC)
Ah, now it's my turn to say 'duh' *smile* I didn't even click on the link *shakes head* I've been staring at tutorials too long today. I'll definitely have a look at your stuff and see if the gestalt is working for me tonight.


-the redhead-
-the redhead-theredhead on August 8th, 2005 12:47 am (UTC)
Note to self - viewing layer code
sir_brettley on August 8th, 2005 02:05 am (UTC)
Though...if you want to keep the rest of the print entries as it is in component, just copy the code from the component source code:


and replace the call to print_entry_header()...


with the four lines from the spiffy date tutorial...

I was confused because you didn't want all the other customizations. That too a while to sink in. lol
-the redhead-theredhead on August 8th, 2005 02:57 am (UTC)
Yeah, I probably wasn't clear about that being all I wanted. I think that the tutorials are wonderful, but it gets a bit confusing for those of us who only play programmers on TV ;) I can handle HTML and hack up a professional webpage, but this CSS stuff is not something I've looked at before today. So, it just goes to prove that being a smarty-pants doesn't mean squat when it comes to learning-a-new-language-inna-day ;)

Sooooo, when you say and replace the call to print_entry_header()...


with the four lines from the spiffy date tutorial...

Can you be more specific? I've been glaring at this for awhile now, so I'm not at my best.

Maybe I should just go have more birthday cake...

-the redhead-
sir_brettley on August 8th, 2005 03:20 am (UTC)
Did someone say "cake"?
Okay, check the test journal page again. I replaced the change everything print_entry function to one that only changes how the date is printed.

Happy Birthday!

-the redhead-theredhead on August 8th, 2005 04:36 am (UTC)
Re: Did someone say "cake"?
Yes!!! Thank you thank you - you totally helped me out by figuring out how to pull out that part of the code *smile*


I'll fix up the colors and font sizes and such tomorrow.

-the redhead-
sir_brettley on August 8th, 2005 04:48 am (UTC)
Re: Did someone say "cake"?
Glad it did the trick!
-the redhead-theredhead on August 8th, 2005 04:43 am (UTC)
Re: Did someone say "cake"?
and thank you for the birthday wishes too *smile*

-the redhead-
Brown Eyed Girlbrowneyedgirl65 on August 8th, 2005 07:04 am (UTC)
Re: Did someone say "cake"?
Happy birthday! I see someone else from component_help was able to give you a hand, there...

nyobserver on August 8th, 2005 05:43 pm (UTC)
Happy Birthday!!!!!!!!!!!!!!!!!!!