PDA

View Full Version : Use Standard Error in your modules (Sort Of)


Briskoda
08-09-2004, 05:40 PM
Since the Vb system uses a full page template to render STANDARD_ERROR, simply copy the required area...eg this:
<br />
<br />
<br />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="70%" align="center">
<tr>
<td class="tcat">BRISKODA Message</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div align="$stylevar[left]">

<if condition="$show['permission_error']">
<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>
<form action="login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)">
<input type="hidden" name="do" value="login" />
<input type="hidden" name="forceredirect" value="1" />
<input type="hidden" name="url" value="$scriptpath" />
<input type="hidden" name="vb_login_md5password" />
$postvars

<input type="hidden" name="s" value="$session[sessionhash]" />

<!-- permission error message - user not logged in -->


<div class="smallfont">$vbphrase[not_logged_no_permission]</div>

<ol>
<li class="smallfont">$vbphrase[not_logged_in_fill_in_form]</li>
<li class="smallfont">$vbphrase[may_not_have_sufficient_privileges]</li>
<li class="smallfont">$vbphrase[administrator_may_disabled_account]</li>
</ol>

<fieldset class="fieldset">
<legend>$vbphrase[log_in]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" align="center">
<tr>
<td>$vbphrase[username]:<br /><input type="text" class="bginput" name="vb_login_username" size="50" accesskey="u" tabindex="1" /></td>
</tr>
<tr>
<td>$vbphrase[password]:<br /><input type="password" class="bginput" name="vb_login_password" size="50" accesskey="p" tabindex="1" /></td>
</tr>
<tr>
<td>
<span style="float:$stylevar[right]"><a href="login.php?$session[sessionurl]do=lostpw">$vbphrase[forgotten_your_password]</a></span>
<label for="cb_cookieuser"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" checked="checked" tabindex="1" />$vbphrase[remember_me]</label>
</td>
</tr>
<tr>
<td align="$stylevar[right]">
<input type="submit" class="button" value="$vbphrase[log_in]" accesskey="s" tabindex="1" />
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" tabindex="1" />
</td>
</tr>
</table>
</fieldset>

<div class="smallfont"><phrase 1="register.php?$session[sessionurl]do=signup">$vbphrase[admin_required_register]</phrase></div>
</form>

<!-- / permission error message - user not logged in -->
<else />
<!-- main error message -->


<blockquote><p>$errormessage</p></blockquote>


<!-- / main error message -->
</if>

</div>
</div>
<!--
<div style="margin-top:$stylevar[cellpadding]px">
<input type="submit" class="button" value="$vbphrase[go_back]" accesskey="s" onclick="history.back(1); return false" />
</div>
-->
</td>
</tr>
</table>


Into a new template called adv_portal_STANDARD_ERROR

From within your PHP module code you can now use this as per Vb would with:
$errormessage = "$bbuserinfo[username], thank you for submitting the $bbtitle $formtitle!";
$response= eval('$home[$mods[\'modid\']][\'content\'] .= "'. fetch_template('adv_portal_STANDARD_ERROR') . '";');

Perhaps there is a better way to do this, as I'm still learning what CMPS will and will not do it's A way for sure. Not brilliant as it's another template, but look and feel is preserved.

Briskoda
08-10-2004, 04:22 AM
IF there are no better ways of achieving this then feel free to move this post to the forums above.