Webmastersite.net
Register Log In

Line Break Parsing in new field
Not working

Comments on Line Break Parsing in new field

babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Jul 29, 2006 - 8:19 AM:

I have a new category field and have set it for Line Break Parsing and WSN Code Parsing. But when I have a linebreak in that field, it shows it correctly in the place where the field is but also shows everything again above the table the field sits in and adds >. If I take the line breaks out then it is fine.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jul 29, 2006 - 5:35 PM:

Sounds like you have it inside a conditional. Line breaks break conditionals. They do work with template PHP.
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Jul 29, 2006 - 11:09 PM:

Paul wrote:
Sounds like you have it inside a conditional. Line breaks break conditionals. They do work with template PHP.


Oh :-( Yes I have it in a table and don't want that row to show if the field is empty. Is there any way around that? I don't understand when you way they worth with template PHP - does that mean there is a way to get round it? I have it in a custom displaylinks template



Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jul 30, 2006 - 10:36 PM:

<?php if ("{SOMETHING}") { ?> show stuff <?php } ?>

Although that, in turn, would break if you have quotes in the value. I don't know of a way to handle quotes and linebreaks at once.
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Jul 31, 2006 - 12:22 AM:

Paul wrote:
<?php if ("{SOMETHING}") { ?> show stuff <?php } ?>



Tried that but I must be doing something wrong as I now get

220: <td>An elegant ....</td>
221: </tr>
222: <?php } ?>
223: <?php if ("Ideal height: dogs: 58-61 cms (23-24 ins); bitches: 56-58 cms (22-23 ins).") { ?>
224: <tr>
225: <td valign="top"><b>Size:</b></td>
< type="text/javascript" src="templates/default/javascriptheader.js">

I have the following in my template:

<?php if ("{CATBREEDORIGINS}"){?>
<tr>
<td width="132" valign="top"><b>Origins:</b></td>
<td >{CATBREEDORIGINS}</td>
</tr>
<?php}?>
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jul 31, 2006 - 6:06 PM:

The only thing I see is that you don't have spaces, but I doubt that'd make a difference. What do you have on the line above, is that an </IF>?

I also note that category template variables starting with {CAT becomes confusing when the data is about dogs. wink
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Jul 31, 2006 - 11:37 PM:

Paul wrote:
The only thing I see is that you don't have spaces, but I doubt that'd make a difference. What do you have on the line above, is that an <?php } ?>?

I also note that category template variables starting with {CAT becomes confusing when the data is about dogs. [/quote]


LOL! Yes, it is an <?php } ?> I tried to attach the template but when I clicked attach I got the following on your site...

---------
If you are not the administrator of this site, please report this page to the administrator. If you are the administrator, please pay careful attention: You have a parse error in your template (or perhaps in your header or footer) which you need to repair before this page can be displayed correctly. The error is picked up on by php at line 175 of the output.Line #170: function submitForm() { updateRTEs(); return true; }
Line #171: initRTE("templates/default/images/posteditor/", "templates/default/", "www.webmastersite.net/forum...mplates/styles/default.css");
Line #172: </script>
Line #173: <script language="JavaScript" type="text/javascript">
Line #174: writeRichText('message', '<br><br>
Paul wrote:
The only thing I see is that you don't have spaces, but I doubt that'd make a difference. What do you have on the line above, is that an <?php } ?>?<br><br>I also note that category template variables starting with {CAT becomes confusing when the data is about dogs. <img src="https://www.webmastersite.net/forums/"https://www.webmastersite.net/forums/templates/default/images/smilies/wink.gif\" border="0">
<br><br> <br>LOL! Yes, it is an <?php } ?> I attach the template<br>', 400, 200, true, false);
Line #175: </script>

[Load this template in your template editor]

Note that the line of the output is not necessarily the same line number in your template... just look for a similar looking area. The source of your error is probably not on line 175 itself, but most likely a line or two before it. Check your code carefully for syntax mistakes. If you cannot recognize one, copy and paste this output into a thread on the support forum.
Now outputing the page without any conditional or php sections evaluated:
---------


Attached Files:
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Aug 01, 2006 - 8:02 PM:

You should be replacing
<IF {CATBREEDORIGINS}>
<tr>

<td width="132" valign="top"><b>Origins:</b></td>
<td >{CATBREEDORIGINS}</td>
</tr>
</IF>
with
<?php if ("{CATBREEDORIGINS}") { ?>
<tr>

<td width="132" valign="top"><b>Origins:</b></td>
<td >{CATBREEDORIGINS}</td>
</tr>
<?php } ?>
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
Posted Aug 01, 2006 - 10:51 PM:

Lord I am a plonker - talk about a dumb blonde!!!!!

I had reverted back to my original template when I couldn't get it to work and sent that!!!! Sorry Paul

Anyway, I don't know what I had done wrong in the first place, prob missed off a comma! but it is now working THANK YOU!
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
#10 - Quote - Permalink
Posted Aug 03, 2006 - 3:42 AM:

I'm still having a problem with this. The first couple were great and worked well, but the moment I put a third one in it goes haywire.

this is the whole table I have, I have only changed 3 IF statements to the ?PHP, the following 4 IF statements will need to be changed too once I can get it working with the 3rd one...

<table width="98%" border="0" align="center" cellpadding="5" cellspacing="0" >
<?php if ("{CATBREEDORIGINS}") { ?>
<tr> <td width="132" valign="top"><b>Origins:</b></td> <td >{CATBREEDORIGINS}</td> </tr>
<?php } ?>
<?php if ("{CATBREEDDESC}") { ?>
<tr> <td width="132" valign="top"><b>Description:</b></td> <td >{CATBREEDDESC}</td> </tr>
<?php } ?>
<IF {CATBREEDTEMPERAMENT}>
<tr> <td width="132" valign="top"><b>Temperament:</b></td> <td >{CATBREEDTEMPERAMENT}</td> </tr>
</IF>

<IF {CATBREEDHEALTH}>
<tr>
<td valign="top"><b>Health:</b></td><td>{CATBREEDHEALTH}</td>
</tr>
</IF>
<IF {CATBREEDCARE}>
<tr>
<td valign="top"><b>Grooming:</b></td><td>{CATBREEDCARE}</td>
</tr>
</IF>
<IF {CATBREEDEXERCISE}>
<tr>
<td valign="top" ><b>Exercise</b></td>
<td >{CATBREEDEXERCISE}</td>
</tr>
</IF>
<tr>
<td valign="top" ><b>Training</b></td>
<td >{CATBREEDTRAINING} <a href=" our books on training</a>
</tr>
<IF {CATBREEDSIZE}>
<tr>
<td valign="top"><b>Size:</b></td><td>{CATBREEDSIZE}</td>
</tr>
</IF>

<IF {CATBREEDGROUP}>
<tr>
<td valign="top"><b>The Kennel Club:</b></td>
<td>Group: {CATBREEDGROUP} &nbsp;&nbsp;&nbsp; {CATBREEDSTANDARD} </td>
</tr>
<tr>
<td colspan="2" valign="top" class="link">For more information and advice, contact one of the Breed Clubs or Breeders listed above. </td>
</tr>
</IF>
</table>
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
#11 - Quote - Permalink
Posted Aug 03, 2006 - 6:20 AM:

OK, this gets weirder.

I'm updating all the categories, changing them to this custom cat and adding data into fields. So far all has gone well. In the fields where I don't have the ?php working I simply do it in one block with no line breaks.

I've now just done another one (after doing 11 with no problem) and it goes haywire when I put text in the field where I have <?php if ("{CATBREEDORIGINS}") { ?>
Origins: {CATBREEDORIGINS}
<?php } ?>.

I have attached the debug in a txt file

Attached Files:
babrees
Expert

Usergroup: Customer
Joined: Aug 19, 2005
Location: England

Total Topics: 391
Total Comments: 1303
babrees
#12 - Quote - Permalink
Posted Aug 03, 2006 - 6:36 AM:

I'm giving up on this - too much hassle and time. I shall simply not have any IF statements against those fields.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
#13 - Quote - Permalink
Posted Aug 05, 2006 - 7:40 AM:

There were quotes within quotes there messing up in your debug.txt. I'll make another try at seeing if there's a way to make conditionals accept line breaks.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.