inherit
218932
0
Nov 15, 2023 9:10:15 GMT -8
artdoc
550
February 2015
artdoc
|
Post by artdoc on Feb 8, 2018 15:04:11 GMT -8
Forum URL: cottonwood.boards.netBuoyed by my success with a simple nudge message for Guests, I ramped it up. Here is my Main Header code: <script> $(document).ready(function () { if (pb.data('is_current_user_guest')) { let html = “ Hello Guest! We get many Visitors each day. Would you please answer a question?<br/> <b>How did you end up here?</b> <br /> It was an <a href="http://cottonwood.boards.net/post/147">accident</a>! ••• I actually <a href="http://cottonwood.boards.net/post/149"> did a search</a>. "; $('#content').prepend(html); } }); </script> Too much? The strange result was that it shows up fine when it does not have the script sniffer to see me as a Guest, but when I add that, NONE of it shows and I get the old original simple message that actually no longer even appears in the Main Header area! My links work, taking a willing Guest to a thread to indicate mistake or search. Related: I discovered that in this case, a link to a page with a POLL included shows the page but not the pill!
|
|
#eb7100
33409
0
1
Apr 29, 2024 9:53:44 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Feb 8, 2018 15:36:43 GMT -8
Hi, artdoc . There are a few issues with your code all revolving around the line where you're declaring the html variable. Your opening quotation mark on this line is a stylized quotation mark and not a normal one. You'll notice that every other set of quotation marks in your script is vertically straight, but this one is italicized likely due to being copied from another source or program that italicizes them: You cannot add line breaks in the middle of a string or the script will assume you're trying to end that line's statement. This all needs to be on one line in between the opening and closing quotation marks, or you need to append each line individually to the variable: Lastly, you need to escape any quotation marks within the string that come before the closing quotation mark. Otherwise the statement assumes that the next quote it comes across is meant to close the string off. This is done by adding a back slash before the quotation marks you wish to escape.
|
|
inherit
218932
0
Nov 15, 2023 9:10:15 GMT -8
artdoc
550
February 2015
artdoc
|
Post by artdoc on Feb 8, 2018 15:47:24 GMT -8
Ahh, smart quotes! Bad. I understand the corrections, but escaping before quotes is familiar lanhuage, but I am not seeing the forward slash escape. Nonetheless, I will copy the example and try again. I thought I was expecting too much, but It guess it was just faulty code.
Thamks.
|
|
#eb7100
33409
0
1
Apr 29, 2024 9:53:44 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Feb 8, 2018 15:58:11 GMT -8
Here's what one of the <a> tags in your code looked like before I escaped the quotation marks in the last bit of code in my post:
And here's what it looks like after escaping the quotes:
Hopefully that helps illustrate which part of the code was escaped.
|
|
inherit
218932
0
Nov 15, 2023 9:10:15 GMT -8
artdoc
550
February 2015
artdoc
|
Post by artdoc on Feb 8, 2018 16:14:06 GMT -8
Okay, I spaced out on remembering \ is the escape. Been awhile.
I am almost there, but not quite. My Guest view of cottonwood.boards.net now does two odd things: 1. The message I want appears sort of correctly, but I cannot center it! I tried adding a div tag and ceneter tags in and out of the div. No worky. 2. The ghost of Guest Welmoe Past still wants to display but it is NOT in the Main Header code area. Global or Man, not there.
Why are standard <center> tags breaking things?
|
|
#eb7100
33409
0
1
Apr 29, 2024 9:53:44 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Feb 8, 2018 16:30:01 GMT -8
1. Include the centered div inside the section of the code where you're composing the HTML. 2. That seems to be located in Themes > Layout Templates > Home on your default theme. Why are standard <center> tags breaking things? I'm not seeing what they're breaking, but <center> tags are deprecated anyways and shouldn't be used. CSS should be what determines things like text alignment and other style choices.
|
|
inherit
218932
0
Nov 15, 2023 9:10:15 GMT -8
artdoc
550
February 2015
artdoc
|
Post by artdoc on Feb 8, 2018 17:51:25 GMT -8
"Welcome, Guest! If you are a Senior Citizen from Placerville, why not Register ?"
That was my initial Guest message. UPDATE: I finally found the code to remove. At last my Guest message is as I wanted it. Now to see if I can get a few answers?
THanks for your help.
|
|