71
phillipd
Re: trouble with "edit.php?op=show&id=$id
  • 2004/11/21 3:16

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


Oh crap, I was using post instead of get. Problem solved.

Doug P



72
phillipd
trouble with "edit.php?op=show&id=$id
  • 2004/11/20 21:45

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


Writing an inventory module I can't seem to pass "op=show" through a smarty template. The "URL" looks ok when I "mouseover" the link but the "op" never gets passed.

Code I've tried:

$row['url'] = "edit.php?op=show&id=$id";
or
$row['url'] = "edit.php?op=show&id='$id'";

$xoopsTpl->append('row',$row);

Template:

<{section name=i loop=$row}>
<tr valign="middle">

<td class="even" ><a href="<{$row[i].url}>"><{$row[i].id}></a></td>
</tr>
<{/section}>


Any suggestions are appreciated.

Thanks

Doug P



73
phillipd
Re: Opera does strange things when clicking in a text area
  • 2004/11/16 17:25

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I found the problem. I had a header line that didn't have a </a> to close out the href:

<h5 style="text-align:center;"><a href="<{$admin_path}>"/><{$lang_admin}></a></h5>

Boy opera is picky...

Doug P



74
phillipd
Opera does strange things when clicking in a text area
  • 2004/11/16 17:12

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I'm posting this in the template forum because I think it's a template problem. My application is basically a form the user enters text into that presses a "go" button. Very simple and straight forward. I use the template below to display it, or a part of it anyway. When I click in any of the text gadgets, when using opera, it goes to another page on my site. This only happens with opera, not IE, mozilla or Konqueror. Any suggestions would really help...

Thanks

Doug P

<{$nrcsiteform.javascript}>
<b><{$nrcsiteform.title}></b>
<form name="<{$nrcsiteform.name}>" action="<{$nrcsiteform.action}>" method="<{$nrcsiteform.method}>" <{$nrcsiteform.extra}>>
<table width="50%" class="outer" cellpadding="4" cellspacing="1">
<!-- start of form elements loop -->
<{foreach item=element from=$nrcsiteform.elements}>
<{if $element.hidden != true}>
<tr>
<td align='right' width="30%" class="head"><b><{$element.caption}></b></td>
<td align='left' width="70%" class="<{cycle values="even,odd"}>"><{$element.body}></td>
</tr>
<{else}>
<{$element.body}>
<{/if}>
<{/foreach}>
<!-- end of form elements loop -->
</table>
</form>



75
phillipd
Re: Is there a way to...
  • 2004/11/12 5:41

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


AHHHH! I finally got it to work! I use:

$i = 0;
while(list($id,$status,$name) = $xoopsDB->fetchRow($result)) {
$tray[$i] = new XoopsFormElementTray("");
$check[$i] = new XoopsFormCheckBox("",$name);
$check[$i]->addOption($id,$name);
if($status) {
$check[$i]->setValue($id);
}
$tray[$i]->addElement($check[$i]);
$form->addElement($tray[$i]);
$i++;
}

---------------------------------------------------------
Then to receive the checkboxes that are selected, I use:

$sql = 'SELECT id,status,name FROM '.$xoopsDB->prefix('gis_layers').' ORDER BY id';
$result = $xoopsDB->query($sql);
while(list($id,$status,$name) = $xoopsDB->fetchRow($result)) {
if(!empty($_POST[$name]) && $_POST[$name] > 0) {
echo "Got $name!<br>";
}
}


Thanks for all your time and your wonderful ideas!

Regards

Doug P



76
phillipd
Re: Is there a way to...
  • 2004/11/12 5:24

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


OK here is the scoop. I can make the select list work, but I don't like it because if the user clicks a list element, all the other selected elements get unselected. They have to hold down the "control" key to prevent this.

I really like the checkboxes better but when I put them in the tray and form in the manner you suggest, they look very messy, not nicely formatted in rows and columns. And, are they a single checkbox with multiple "options". How do you nicely format multiple gadgets placed in the same tray?

In order to nicely format them, I use arrays of trays, and checkboxes like this:

$form = new XoopsThemeForm("", "layerform", "setlayers.php");
$check = array();
while(list($id,$status,$name) = $xoopsDB->fetchRow($result)) {
$tray[$i] = new XoopsFormElementTray("");
$check[$i] = new XoopsFormCheckBox("",$name);
$check[$i]->addOption($id,$name);
if($status) {
$check[$i]->setValue($id);
}
$tray[$i]->addElement($check[$i]);
$form->addElement($tray[$i]);
}

But then they are separate elements and I can't programatically get at them in the recieving script. How can I send this array of individual checkboxes to my recieving script?

Thanks again...

Doug P



77
phillipd
Re: Has anyone had trouble with admin scripts and smarty?
  • 2004/11/12 3:18

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I'm really sorry, I had a if in the template with no else:

<{if $element.hidden != true}>
and forgot to put:

<{else}>
                <{
$element.body}>
            <{/if}>
It's working fine now. (Sheepish grin)

Thanks

Doug P



78
phillipd
Has anyone had trouble with admin scripts and smarty?
  • 2004/11/12 2:28

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I'm doing an "admin" script and trying to use smarty. The script works ok the first pass through, it sets up my form and display's everything properly, but then when I put a hidden op and button in the form and press the button, the op is never passed and I can't pass control to another part of the script with the typical if ($op == 'whatever') .

Has anyone else seen this behavior? It's as though it's ignoring the hidden op:


$op_submit = new XoopsFormHidden("op""submit");
    
$submit_button = new XoopsFormButton("""""Set as Default""submit");

    
$form = new XoopsThemeForm("""layerform""setlayers.php");

    
$form->addElement($tray_defaults);
    
$form->addElement($submit_button);
    
$form->addElement($op_submit);

    
$form->assign($xoopsTpl);
    
$xoopsTpl->display('db:'.$xoopsOption['template_main']);

Thanks

Doug P



79
phillipd
Re: Is there a way to...
  • 2004/11/11 21:43

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I seem to have a more fundamental problem now. I'm using Smarty in an "admin" script and my Buttons aren't submitting a "op" to my recieving script, which is actually the same as my form script. Nothing in the "op == submit" block ever gets executed and "op" never = "submit". This must be why no one uses smarty in admin scripts??? Am I missing an include somewhere?

include '../../../mainfile.php';
include '../../../include/cp_header.php';
include "../language/english/main.php";

if ( isset($HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] == "submit" ) {
$op = "submit";
echo "Setting op to submit";
}
if ( isset($HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] == "form" ) {
$op = "form";
echo "Setting op to form";
}


if ( $op == "form" ) {
xoops_cp_header();
require_once SMARTY_DIR.'Smarty.class.php';
$xoopsTpl = new Smarty;
$xoopsOption['template_main'] = 'ecngis_admin.html';
include XOOPS_ROOT_PATH."/header.php";
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";

#
# Fill in the select gadget
#
$select_defaults = new XoopsFormSelect("","defaults","","10",true);
$tray_defaults = new XoopsFormElementTray(_MM_LAYERS, "&nbsp;");

$sql = 'SELECT id,status,name FROM '.$xoopsDB->prefix('gis_layers').' ORDER BY id';
$result = $xoopsDB->query($sql);

while(list($id,$status,$name) = $xoopsDB->fetchRow($result)) {
$select_defaults->addOption($id,$name);
if($status) {
$select_defaults->setValue($id);
}
}

$tray_defaults->addElement($select_defaults);

$op_submit = new XoopsFormHidden("op", "submit");
$submit_button = new XoopsFormButton("", "", "Set as Default", "submit");

$form = new XoopsThemeForm("", "layerform", "setlayers.php");

$form->addElement($tray_defaults);
$form->addElement($submit_button);
$form->addElement($op_submit);

$form->assign($xoopsTpl);
$xoopsTpl->assign('lang_layers', _MM_LAYERS);

$xoopsTpl->display('db:'.$xoopsOption['template_main']);
xoops_cp_footer();
}

if ( $op == "submit" ) {
xoops_cp_header();
require_once SMARTY_DIR.'Smarty.class.php';
$xoopsTpl = new Smarty;
$xoopsOption['template_main'] = 'ecngis_admin.html';
include XOOPS_ROOT_PATH."/header.php";
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";

$layers = "";
echo "2222222222222222222222222222222222222222222222222";
$defaults = $_POST['select_defaults'];
foreach ( $defaults as $key => $val) {
echo "-----$key,$val";
}
}



80
phillipd
Re: Is there a way to...
  • 2004/11/11 16:41

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


OK, that works, but now I'm totally confused. Why am I doing a setValue($id)? $id changes with each iteration of the while loop. Why aren't I setting a value of "1" or "0" depending on if I want the list item highlighted or not. I must have a basic misunderstanding of what setValue does.

Now in my recieving script, how do I determine if a element in the list is selected?

Doug P (I really appreciate the help)




TopTop
« 1 ... 5 6 7 (8) 9 10 11 ... 22 »



Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!