41
xsell
Column Layout in Smarty
  • 2010/1/27 0:46

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello..

My Quastion Very Simple , How to Make My block Prints out the Records into Column instaed Row ..

this is my Block Code.
include_once XOOPS_ROOT_PATH."/include/xoopscodes.php";
function 
b_news_blocks_show($options) {
    global 
$xoopsUser$xoopsConfig$xoopsDB;
    
$block = array();
$myts =& MyTextSanitizer::getInstance();

$sql=$xoopsDB->query("select count(id) from ".$xoopsDB->prefix("test")."");
list(
$numrows) = $xoopsDB->fetchRow($sql);
 
$result $xoopsDB->query("SELECT id FROM ".$xoopsDB->prefix("test")." order by id desc limit ".$options[1]."");
    while(
$myrow $xoopsDB->fetchArray($result)){
    
$mytest= array();
    
        
$mytest['name'] = $myts->htmlSpecialChars($myrow['name']);
                    
$block['lang_xname'] = _MB_MYNAME;
                    
        
$block['mytest'][] = $mytest;
    }

    return 
$block;
}

function 
b_news_blocks_edit($options) {
    
$form "Noumber of Names  ";
    
$form .= "<input type='hidden' name='options[]' value='";
    
$form .= "date'";
    
$form .= " />";
    
$form .= "<input type='text' name='options[]' value='".$options[1]."' />&nbsp;#";
    return 
$form;
}


this is my Template which prints the result in Row , I need it to print it out to 2 column .
<table cellpadding="5" cellspacing="5" class="outer">
<{foreach 
item=mytest from=$block.mytest}>
  
<
tr>
<
td class="even">
<
div>
<{
$mytest.name}></div>
</
td>

</
tr>
<
tr>
  <{/foreach}>
</
tr>
</
table>



42
xsell
Uploading to server and write Name to Mysql
  • 2010/1/20 7:26

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello

This is My code , Will Upload a file to my site and write the name of the file to my Database ..

The Quastion is , the Uploading Is Opetional , I do not want the user get error after sumbit, that no file was Uploaded , since its not Optional ..

2- this code is updating to the MySQL , so the problem i have , if there already a name exist and the user did not upload file , the code updates the row with the embty value .
i wanted it that if the user did not upload file to keep the "file" row as is no change to the name , and the Change only if the user Uploaded file ..

form
xoops_load('xoopsformloader');
$sform = new XoopsThemeForm(_MD_TEST_ADD"form""upload.php");

$sform->setExtra("enctype='multipart/form-data'");
$sform->addElement(new XoopsFormText(_MD_TEST_NAME'name'5030));

$sform->addElement(new XoopsFormFile(_MD_TEST_ATTACHMENTS'xoops_upload_file'0), false);

$button_tray = new XoopsFormElementTray('' ,'');
$button_tray->addElement(new XoopsFormButton('''submit'_MD_TEST_SEND'submit'));
$sform->addElement($button_tray);
$sform->display();


upload.php

//Upload things
    
$uploading=($_FILES['xoops_upload_file']['name']);

   
$idHtmlSpecialchars($_GET['id']);

  include_once 
'../../../class/uploader.php';
  
$allowed_mimetypes = array('image/gif''image/jpeg');
$maxfilesize 10485760;
$target "upload/";

 
$uploader = new XoopsMediaUploader($target$allowed_mimetypes$maxfilesize);
 
 if (
$uploader->fetchMedia($_POST["xoops_upload_file"][0])) {
 
$uploader->setTargetFileName($uploader->mediaName);

    if (!
$uploader->upload()) {
    
       
redirect_header(XOOPS_URL "/modules/test/index.php" 6$uploader->getErrors());
    } else {
      
//  echo ""._MD_TEST_ADDED."";
    
}
} else {
   
redirect_header(XOOPS_URL "/modules/test/index.php" 5$uploader->getErrors());
}
}
//Upload things

 
$query =mysql_query("UPDATE  ".$xoopsDB->prefix("test")." SET name='$name', file='$file'  WHERE id='$id' ")
  or die(
"can't edit the test tble");



43
xsell
Re: setting upload size
  • 2010/1/20 7:18

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Preferences Main »» User Info Settings



44
xsell
Re: what gallery modules are you using?
  • 2010/1/13 7:13

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Try gallery from optikool.
http://www.optikool.com/modules/mydownloads/viewcat.php?cid=2



45
xsell
Re: Language define in javascript confirm ?
  • 2010/1/10 22:56

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


do you have to echo it , can not u use html ?. see an example i use .below .beside in your Code . u wrote <?php as <php . in
<Php echo _AM_INDEXSCAN_DELETESURE;
and any way why do u use the tags <? and ?> when u already echo your Code .
return confirm(<?php echo _AM_INDEXSCAN_CLEAN;?>);


keep it html javescript easy to use for me this is my example for confirmation click .

<script type="text/javascript">
<!--
  function 
confirmation3() {
    var 
answer confirm("<? echo ""._MI_TOOLS_JAVAALERT3.""; ?>")
    if (
answer){

        
window.location "do_approve_com.php?action=statusr";
    }
    else{
        
alert("<? echo ""._MI_TOOLS_JAVAALERT_CANCEL.""; ?>")
    }
}
//-->
  
</script>
<!--
/// JAVASCRIPT ALERT END HERE
 //-->



46
xsell
Re: blank page when i login by admin account
  • 2010/1/6 19:32

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Since the Site working Ok with zetagenesis theme then it must be your Theme Messed Up , if u edit ur theme with frontpage and saved it . Most the time Old fronpage Version Mess up the smarty Virable <{$something}> will be ;get{$something}; or other Random Charechters .. i have had that before



47
xsell
Re: Different database for each modules
  • 2010/1/6 19:26

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Short Answer " No you Can not Do that "

But it is Not impossible .. From my View it will be Very Hard .and even if it work u will have truble here and there . as each Module will Have to connect to the Mainfile.php .



48
xsell
Re: XoopsFormHidden
  • 2010/1/5 19:23

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Dylian Thank you Man ,

I feel Very Stupid , How in the World I could Not think about that .. Your Total Correct . it Should Be .

$form = new XoopsThemeForm(_MI_SEND"form1""send.php?id=".$id);


Not

$form = new XoopsThemeForm(_MI_SEND"form1""send.php");


with That No need for Extra Hidden Filed , i can remove it Now ..

Shame On me , was very Simple if Paid Good attention to my Code ..

Thank you Dylian for Ponited it Out.



49
xsell
Re: XoopsFormHidden
  • 2010/1/5 3:25

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Thx Dylian ,

My way and your way Still Give the Same Result .

Ok this The Problem in Simple Words .

the $ID Value Should Be Replaced with the actual ID Number.

But For Some reason the $ID Value if i make the Form Hidden Stays Empty.

See the Image Explain to You Better.
Resized Image



50
xsell
Re: XoopsFormHidden
  • 2010/1/2 0:20

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


up :)




TopTop
« 1 2 3 4 (5) 6 7 8 ... 21 »



Login

Who's Online

141 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 141


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits