21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 321 Views |
-
html tag showed (inside layout)

16 July 2011 at 3:05am Last edited: 16 July 2011 3:07am
i created a BusinessPartner DataObject
here is the structureroot
businesspartner/
.. _config.php
.. code/
....BusinessPartner (extends DataObject)
....BusinessPartnerAdmin (extends ModelAdmin)
mysite
sapphire
..
..
..=====================
in my page i added// class Page extends SiteTree
...
...
public static $db = array('BusinessPartner' => 'Boolean');function getCMSFields() {
$fields->addFieldToTab("Root.Content.BusinessPartner", new CheckboxField('BusinessPartner', 'Include a Business Partner on this page?'));
}
...
...
=================
in Page_Controllerfunction BusinessPartner() {
if($this->BusinessPartner) {
$d['BusinessPartner'] = DataObject::get('BusinessPartner');
return $this->customise($d)->renderWith('BusinessPartner');
}
return FALSE;
}=====================
in templates/Layout/Page.ss
i add $BusinessPartner (after $Content)i also create a Layout for BusinessPartner (templates/Layout/BusinessPartner.ss)
when the page created, the data showed. but the HTML tag not showed correctly. instead its showed all html tags
<table border="1">
<tr>
<td>Agent Name</td>
<td>Address</td>
<td>Tel / Fax</td>
<td>PIC</td>
<td>Email</td>
</tr>
<% control BusinessPartner %>
<tr>
<td>$AgentName</td>
<td>$Address</td>
<td>$Telephone / $Fax</td>
<td>$PicAgent</td>
<td><a href="mailto:$Email">$Email</a></td>
</tr>
<% end_control %>the tag <table>, <tr>, <td> showed, and the data from control BusinessPartner looped from database.
what i missed here ???
-
Re: html tag showed (inside layout)

1 August 2011 at 6:50pm
There is no closing </table> tag, that could be it.
| 321 Views | ||
|
Page:
1
|
Go to Top |


