Categories > TinyButStrong general >

The character used to define the message.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Phillip
Date: 2004-03-21
Time: 17:12

The character used to define the message.

Hi,
I've been using TinyButStrong now for a few weeks and would like to say thank you.  It has made my web work much simpler.

I have one question:
I am using the simple code:

<p>[var.message;htmlconv=no]</p>

in my template and this piece of code in my pages:

$message = '
my html code here
';
$TBS->Show() ;

My problem is the apostrophe.

Often in normal text you use it for contractions and possession.  It is easy to change the contractions but not so easy to change the possession.  For example "John's House" is cumbersome when expressed as "The house belonging to John" especially if it is a title.

IS there a way to change this character to another one (Not sure which one!) or a special combination?

TIA
Phillip
By: Skrol29
Date: 2004-03-21
Time: 23:00

Re: The character used to define the message.

Hi,

I'm not sure to understand, but it seems to be a pure PHP problem isn't it ?
You can specify an apostroph in a string by protecting it with the \ char, or using " instead of ' as string delimitors.
By: RwD
Date: 2004-03-21
Time: 23:06

Re: The character used to define the message.

I do not understand the exact problem, because you do not tell where the apostrophe is actually used in your code.

In general use escape characters.

\' when you are in a single quote delimited string. ex: 'John\'s house'
\" when in a double quote delimited string
'' also works for some systems, but I don't know where exactly. I know it works for Delphi strings, but that doesn't really help...

What about htmlconv=esc ???

If this didn't help you, then could you please give a short, complete, example of where things go wrong??
By: Phillip
Date: 2004-03-22
Time: 15:04

Re: The character used to define the message.

Sorry for not being clearer.
$message = '
my html code here
';
$TBS->Show() ;
What I was trying to say was that if I have an apostrophe in my html code then tbs assumes that it is the end of my message and I get an error.
The apostrophe at the end of the $message line seems to indicate the start of the message and the apostrophe in front of the semicolon indicates the end.  If in my html code is "john's house" that apostrophe is assumed to be the end of the message, but since there's not a semicolon and the $TBS->Show() ; code it crashes.


I use apostrophes in the text of my html code. Here's an example:
<li>
      <p   class="gameslisttext">
      <a href="http://www.karljones.com/halflife/almanac.asp"  target="_blank">Handy Vandal's
      Almanac</a> - An incredible site dedicated to HL editing.</li>

I hope that's clearer!

Phillip
By: RwD
Date: 2004-03-22
Time: 20:08

Re: The character used to define the message.

Perhaps then my reply wasn't clear enough either?

instead of ' use \'
example: 'John\'s house'

the problem will also occurr for the backslahs itself.

So for every string replace the \ with \\
Then replace every ' with \'

In that order!!!!
(Otherwise your freshly replaced apotrophes (\') will look like \\' which again gives you an error)

If you do not know what to do now please look at the php manual, as it explains this. You can get it from www.php.net
By: Phillip
Date: 2004-03-23
Time: 15:07

Re: The character used to define the message.

Hi,

Thanks for the replies.

replacing ' with \' works.

Thank you.