You are not logged in! If you have not registered yet then click here to join the community!

TOLRA Community Forums


Go Back   TOLRA Community Forums > TOLRA Products (PHP Scripts) > Web Directory Script > Directory Script Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2006, 10:21 PM
Paul's Avatar
Paul Paul is offline
Moderator
 
Join Date: May 2006
Location: UK
Posts: 568
Blog Entries: 3
Customising the Full Description submission field

Unlike the other fields on the submission and update forms that are in the template, the 'Full Description' field is drawn by PHP.

For historical reasons, the full description entry area is drawn as:
Code:
<tr>
	<td class="inbox">
		<div class="right"><label for="Full_Description__txt_max4096"><b>Full Description:<br/></b>(optional)</label></div><div>Optional detailed information for your listing. <br/><b>NOTE:&nbsp;</b>Must be in English.</div>
	</td>
	<td class="inbox">
		<textarea name="Full_Description__txt_max4096" id="Full_Description__txt_max4096" rows="8" cols="50" tabindex="1000"></textarea>
	</td>
</tr>
However the way this is drawn can easily be changed by editing the main index.php.

In the following example the output is changed to draw the 'Full Description' field without the use of tables, this assumes that the template files t!wdmod.html and t!wdadd.html have also been updated not to use tables for the update and submit forms.

In index.php locate the line:
Code:
 $wd = new wdClient();
Replace it with:
Code:
class myClient extends wdClient {
	function detailDrawFields(& $tpl, $detail, $noedit, $express) {
		$dis = $noedit ? ' readonly="readonly"' : '';
		$s = '<p><label for="Full_Description__txt_max4096"><b>' . tr('Full Description') . ': </b></label>';
		$s .= tr('Optional detailed information for your listing. (Must be in English.)</p>');
		$s .= '<textarea' . $dis . ' name="Full_Description__txt_max4096" id="Full_Description__txt_max4096" rows="8" cols="50" tabindex="1000">';
		$s .= afHTMLChars(bbcodeXHTML::XtoB($detail));
		$s .= '</textarea>';

		$tpl->setValue('detailInput', $s);
	}
}
$wd = new myClient();
When you view either the submission or update form the new version of the 'Full Description' filed will be drawn.
Reply With Quote
Sponsored Links
  #2  
Old 02-04-2007, 05:26 PM
beejay beejay is offline
Junior Member
 
Join Date: Mar 2007
Posts: 17
I'm working with a script that has had a mod installed by you. I didn't find this line:
Code:
$wd = new wdClient();
I instead found this line:
Code:
$wd = new privwdClient();
What, if anything, do I need to do to make this work without tables? Client wishes to add ajax functionality and specifically asked for tables to disappear. Yell if you need me to post whole index.php, since privwdClient is mentioned above that with an "addition" that states before it:

Code:
class privwdClient extends wdClient {
Reply With Quote
  #3  
Old 02-04-2007, 05:51 PM
Paul's Avatar
Paul Paul is offline
Moderator
 
Join Date: May 2006
Location: UK
Posts: 568
Blog Entries: 3
As you have a mod installed there is almost certainly a new version of function detailDrawFields in index.php this is the one that should be customised.

If it is not there then you can copy function detailDrawFields into the class privwdClient.

To completely remove tables you need to edit t!wdadd.html and t!wdmod.html templates along with the function detailDrawFields.
Reply With Quote
  #4  
Old 03-04-2007, 03:18 PM
beejay beejay is offline
Junior Member
 
Join Date: Mar 2007
Posts: 17
Okay, so I'm PHP challenged, help me along here. This is what I found in index.php:

Code:
	function detailDrawFields(& $tpl, $detail, $noedit, $express) {
		$dis = '';

        $dis = !$express ? ' readonly="readonly"' : '';
		$tpl->setValue('readOnly', !$express ? ' disabled="true"' : '');

		$s = '';

        $s .= '<tr><td class="inbox">Address:</td>';
		$s .= '<td class="inbox"><input type="text" name="Address1__txt_max100" value="';
		$s .= $this->valueSet['address1'];
		$s .= '" size="40" tabindex="1010"/></td></tr>';

        $s .= '<tr><td class="inbox">Country:</td>';
		$s .= '<td class="inbox"><input type="text" name="Country1__txt_max65" value="';
		$s .= $this->valueSet['country1'];
		$s .= '" size="40" tabindex="1011"/></td></tr>';

        $s .= '<tr><td class="inbox">City:</td>';
		$s .= '<td class="inbox"><input type="text" name="City1__txt_max100" value="';
		$s .= $this->valueSet['city1'];
		$s .= '" size="40" tabindex="1012"/></td></tr>';

        $s .= '<tr><td class="inbox">County:</td>';
		$s .= '<td class="inbox"><input type="text" name="County1__txt_max100" value="';
		$s .= $this->valueSet['county1'];
		$s .= '" size="40" tabindex="1013"/></td></tr>';

        $s .= '<tr><td class="inbox">State:</td>';
		$s .= '<td class="inbox"><input type="text" name="State1__txt_max100" value="';
		$s .= $this->valueSet['state1'];
		$s .= '" size="40" tabindex="1014"/></td></tr>';

		$s .= '<tr><td class="inbox">Zip Code:</td>';
		$s .= '<td class="inbox"><input type="text" name="Postcode1__txt_max100" value="';
		$s .= $this->valueSet['zipcode1'];
		$s .= '" size="40" tabindex="1015"/></td></tr>';

		$s .= '<tr><td class="inbox">Phone Number:</td>';
		$s .= '<td class="inbox"><input type="text" name="Phone1__txt_max100_req" value="';
		$s .= $this->valueSet['phone1'];
		$s .= '" size="40" tabindex="1016"/></td></tr>';
		
		$s .= '<tr><td class="inbox">Contact:</td>';
		$s .= '<td class="inbox"><input type="text" name="Contact1__txt_max100_req" value="';
		$s .= $this->valueSet['contact1'];
		$s .= '" size="40" tabindex="1017"/></td></tr>';

		$s .= '<tr><td class="inbox">';
		$s .= '<div class="right"><label for="Full_Description__txt_max4096"><b>Full Description:<br/></b>(optional)</label></div>';
		$s .= '<div>Optional detailed information for your listing. <br/><b>NOTE:&nbsp;</b>Must be in English.</div>';
		$s .= '</td><td class="inbox"><textarea '. $dis . 'name="Full_Description__txt_max4096" id="Full_Description__txt_max4096" rows="8" cols="50" tabindex="1017">';
		$s .= htmlentities(bbcodeXHTML::XtoB($detail));
		$s .= '</textarea></td></tr>';

		$s .= '<tr class="exponlytop"><td colspan="2">';
		$s .= '<p>Premium submissions may include an additional 5 links to sub pages of the site; <strong>any links not meeting the following requirements will be removed</strong>:<p>';
		$s .= '<ul class="revlst">';
		$s .= "<li>The link <strong>must</strong> point to a page that is part of your site and which can be accessed from the home page.<br />If the route from the home page isn't immediately obvious then include directions in the comment field below.</li>";
		$s .= "<li>The link <strong>must not</strong> point to a page which has a limited lifespan, e.g. a promotional offer.</li>";
		$s .= "<li>The domain for the links <strong>must</strong> match that of the site being submitted.</li>";
		$s .= "<li>The link title <strong>must</strong> be representative of the page content and each title <strong>must</strong> be different.</li>";
		$s .= "<li>Each page <strong>must</strong> have different content.</li>";
		$s .= '</ul>';
		$s .= "</td></tr>\n";

		$dis2 = (strlen(trim($this->valueSet['title1'])) || strlen(trim($this->valueSet['url1']))) ? '' : $dis;

        $s .= '<tr><td><div class="right"><label for="URL_Title_1__txt_max40"><b>URL Title 1:</b></label></div>The title for the link e.g. Contact Us<br />(40 characters max).</td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_Title_1__txt_max40" value="';
		$s .= $this->valueSet['title1'];
		$s .= '" size="40" maxlength="40" tabindex="1018"/></td></tr>';

        $s .= '<tr><td><div class="right"><label for="URL_1__txt_max150"><b>URL 1:</b></label></div>The address of the page including the leading http://.</td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_1__url_max150" value="';
		$s .= $this->valueSet['url1'];
		$s .= '" size="40" maxlength="150" tabindex="1019"/></td></tr>';

		$dis2 = (strlen(trim($this->valueSet['title2'])) || strlen(trim($this->valueSet['url2']))) ? '' : $dis;

        $s .= '<tr><td><div class="right"><label for="URL_Title_2__txt_max40"><b>URL Title 2:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_Title_2__txt_max40" value="';
		$s .= $this->valueSet['title2'];
		$s .= '" size="40" maxlength="40" tabindex="1020"/></td></tr>';

        $s .= '<tr><td><div class="right"><label for="URL_2__txt_max150"><b>URL 2:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_2__url_max150" value="';
		$s .= $this->valueSet['url2'];
		$s .= '" size="40" maxlength="150" tabindex="1021"/></td></tr>';

		$dis2 = (strlen(trim($this->valueSet['title3'])) || strlen(trim($this->valueSet['url3']))) ? '' : $dis;

        $s .= '<tr><td><div class="right"><label for="URL_Title_3__txt_max40"><b>URL Title 3:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_Title_3__txt_max40" value="';
		$s .= $this->valueSet['title3'];
		$s .= '" size="40" maxlength="40" tabindex="1022"/></td></tr>';

        $s .= '<tr><td><div class="right"><label for="URL_3__txt_max150"><b>URL 3:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_3__url_max150" value="';
		$s .= $this->valueSet['url3'];
		$s .= '" size="40" maxlength="150" tabindex="1023"/></td></tr>';

		$dis2 = (strlen(trim($this->valueSet['title4'])) || strlen(trim($this->valueSet['url4']))) ? '' : $dis;

        $s .= '<tr><td><div class="right"><label for="URL_Title_4__txt_max40"><b>URL Title 4:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_Title_4__txt_max40" value="';
		$s .= $this->valueSet['title4'];
		$s .= '" size="40" maxlength="40" tabindex="1024"/></td></tr>';

        $s .= '<tr><td><div class="right"><label for="URL_4__txt_max150"><b>URL 4:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_4__url_max150" value="';
		$s .= $this->valueSet['url4'];
		$s .= '" size="40" maxlength="150" tabindex="1025"/></td></tr>';

		$dis2 = (strlen(trim($this->valueSet['title5'])) || strlen(trim($this->valueSet['url5']))) ? '' : $dis;

        $s .= '<tr><td><div class="right"><label for="URL_Title_5__txt_max40"><b>URL Title 5:</b></label></div></td>';
		$s .= '<td><input type="text" '. $dis2 . 'name="URL_Title_5__txt_max40" value="';
		$s .= $this->valueSet['title5'];
		$s .= '" size="40" maxlength="40" tabindex="1026"/></td></tr>';

        $s .= '<tr><td><div class="right"><label for="URL_5__txt_max150"><b>URL 5:</b></label></div></td>';
		$s .= '<td ><input type="text" '. $dis2 . 'name="URL_5__url_max150" value="';
		$s .= $this->valueSet['url5'];
		$s .= '" size="40" maxlength="150" tabindex="1027"/></td></tr>';

		$tpl->setValue('detailInput', $s);
	}
NOW what do I do? Just rip the table code out here? or is there an easier way?
Reply With Quote
  #5  
Old 03-04-2007, 03:42 PM
Paul's Avatar
Paul Paul is offline
Moderator
 
Join Date: May 2006
Location: UK
Posts: 568
Blog Entries: 3
Yes, rip out the <tr> and <td> tags and you should be tableless, you might need to replace </td> tags with something to break the labels away from the input fields depending on the layout you are trying to achieve.

The 1st field changes from:
Code:
        $s .= '<tr><td class="inbox">Address:</td>';
		$s .= '<td class="inbox"><input type="text" name="Address1__txt_max100" value="';
		$s .= $this->valueSet['address1'];
		$s .= '" size="40" tabindex="1010"/></td></tr>';
To:
Code:
        $s .= '<label>Address:</label>';
		$s .= '<input type="text" name="Address1__txt_max100" value="';
		$s .= $this->valueSet['address1'];
		$s .= '" size="40" tabindex="1010"/>';
That then outputs:
Code:
<label>Address:</label><input type="text" name="Address1__txt_max100" value="something" size="40" tabindex="1010" />
Reply With Quote
  #6  
Old 03-04-2007, 03:53 PM
beejay beejay is offline
Junior Member
 
Join Date: Mar 2007
Posts: 17
Thanks!

I realize you said this bit of html in the php is for backward compatibility, and your consideration of past purchasers is to be commended, but I hope in future versions it's right in the templating. Would make it a bunch easier for us front-enders, as I'm sure you realize. You were the target of a few well chosen curse words before I found this thread.
Reply With Quote
  #7  
Old 03-04-2007, 04:09 PM
Paul's Avatar
Paul Paul is offline
Moderator
 
Join Date: May 2006
Location: UK
Posts: 568
Blog Entries: 3
If the script isn't modded then this is normally taken care of in the HTML templates, only once you mod the script does it move so much of the form to the PHP.

I've not tried it but you should be able to move this back to the templates by:

1) In the template create for form element and give the value attribute a template name e.g. {$myAddress1}
2) Replace the PHP with $tpl->setValue('myAddress1', $this->valueSet['address1']);

As skinning is usually a one time event I would just edit the PHP as previously described.

At some point backwards compatibility will have to go and I can move to nice clean tableless markup, however we already get complaints about not using tables for layout so I don't think the general design world is quite ready for that yet.
Reply With Quote
Reply

Bookmarks

Tags
customising, description, field, full, submission

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:24 AM.