Jump to content

arturg

Members
  • Posts

    9
  • Joined

  • Last visited

arturg's Achievements

Newbie

Newbie (2/6)

0

Reputation

  1. hi, I have problem, plugin turns letter "e" to "-" in user name , anyone can help ?
  2. ok, i change: $('.pwbutton').click(function () { $.get('/change-status', { pid: $(this).data('pid'), change: $(this).data('change') }, function () { alert("success"); //e.g. update page status on dashboard }).fail(function () { alert("error"); //e.g. error message }); }); to: $('.pwbutton').click(function () { $.get('<?php echo $pages->get('/change-status/')->url ?>', { pid: $(this).data('pid'), change: $(this).data('change') }, function () { alert("success"); //e.g. update page status on dashboard }).fail(function () { alert("error"); //e.g. error message }); }); It works !
  3. ok, i try your code, something goes wrong ,i have succes messege but nothing update in dashboard. My change-status.php <?php $p = $pages->get((int) $input->get->pid); if($p->id) { if($input->get->change == 'trash') { $p->trash(); } else { if($input->get->change == 'unpublish') { $p->addStatus(Page::statusUnpublished); } elseif($input->get->change == 'publish') { $p->removeStatus(Page::statusUnpublished); } $p->save(); } } ?> user-profile.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <button class="pwbutton" data-pid="1124" data-change="publish">pub</button> <button class="pwbutton" data-pid="1124" data-change="unpublish">unpub</button> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <script> $('.pwbutton').click(function () { $.get('/change-status', { pid: $(this).data('pid'), change: $(this).data('change') }, function () { alert("success"); //e.g. update page status on dashboard }).fail(function () { alert("error"); //e.g. error message }); }); </script> </body> </html>
  4. ok, everything works perfectly, I would go one step further and use the AJAX method, could you help me create the sample code. For example, unpublish the page?.
  5. thanks for answers, i would like to create dashboard for users , in dashboard users have a list of pages and small buttons for publish/unpublish , edit and delete. Can you help me how to implement that ?
  6. Hi guys, my question is how to create in front end publish/unpublish delete link ?. Like this example: <a href="???">Unpublish page</a> etc. with hide/delete/hide/publish ?
  7. ok, but I have page message.php with edit link like this: <a href="<?php echo $pages->get(1109)->url; ?>?s=<?php echo $page->id; ?>">edit</a> this link me to the edit.php with: <?php // get a page $editpage = $pages->get($_GET["s"]); $ignorefields = array("isOld","language_published"); $form = $modules->get("InputfieldForm"); $form->method = 'post'; $form->action = './'; // get the collection of inputs that can populate this page's fields $inputfields = $editpage->getInputfields(); // make all the fields required and add them to the form foreach($inputfields as $inputfield) { if(in_array($inputfield->name, $ignorefields)) continue; $form->add($inputfield); } // the inputfields don't already have a submit button, so we'll add one. $submit = $modules->get("InputfieldSubmit"); $submit->name = "submit"; $submit->value = 'Submit'; // add the submit button the the form $form->add($submit); $out = ''; // process the form if($this->input->post->submit) { // now we assume the form has been submitted. // tell the form to process input frmo the post vars. $form->processInput($this->input->post); // see if any errors occurred if( count( $form->getErrors() )) { // re-render the form, it will include the error messages $out .= $form->render(); } else { // successful form submission, so populate the page with the new values. $editpage->setOutputFormatting(false); foreach($form as $field) { $editpage->set($field->name, $field->value); } // save it $editpage->save(); $out .= "Page saved."; $out .= $form->render(); } } else { $out .= $form->render(); } echo $out;
  8. Hi, I.m creating edit page for other pages and I would like to take page Id from $_GET, i have this error: Error: Call to a member function numChildren() on a non-object (line 382 of /home/creacode/public_html/minskmazowiecki.praca.24.net.pl/wire/core/PagesEditor.php) And this is my code: <?php $pageId = ($_GET["s"]); // get a page $editpage = $pages->get($pageId); $ignorefields = array("isOld","language_published"); $form = $modules->get("InputfieldForm"); $form->method = 'post'; $form->action = './'; // get the collection of inputs that can populate this page's fields $inputfields = $editpage->getInputfields(); // make all the fields required and add them to the form foreach($inputfields as $inputfield) { if(in_array($inputfield->name, $ignorefields)) continue; $form->add($inputfield); } // the inputfields don't already have a submit button, so we'll add one. $submit = $modules->get("InputfieldSubmit"); $submit->name = "submit"; $submit->value = 'Submit'; // add the submit button the the form $form->add($submit); $out = ''; // process the form if($this->input->post->submit) { // now we assume the form has been submitted. // tell the form to process input frmo the post vars. $form->processInput($this->input->post); // see if any errors occurred if( count( $form->getErrors() )) { // re-render the form, it will include the error messages $out .= $form->render(); } else { // successful form submission, so populate the page with the new values. $editpage->setOutputFormatting(false); foreach($form as $field) { $editpage->set($field->name, $field->value); } // save it $editpage->save(); $out .= "Page saved."; $out .= $form->render(); } } else { $out .= $form->render(); } echo $out;
  9. i have problem with send muliple files, for one file it works, for multiple not, what should I do with this code ? <?php if($_POST){ unset($_POST["send"]); //print_r($_POST); unset($_POST["pliki"]); $p = new Page(); $p->template = 'page'; $p->parent = '1043'; $p->user_id = $user['id']; foreach($_POST as $v=>$pr){ if($pr!=''){ $p->{$v} = $pr; } } $p->save(); $pp = $pages->get($p->id); $pp->setOutputFormatting(false); if(isset($_FILES['pliki'])){ $errors= array(); $file_name = $_FILES['pliki']['name']; $file_size =$_FILES['pliki']['size']; $file_tmp =$_FILES['pliki']['tmp_name']; $file_type=$_FILES['pliki']['type']; $file_ext=strtolower(end(explode('.',$_FILES['pliki']['name']))); //$name = strtolower($sanitizer->name($file_name)); //'../../site/assets/files/'.$p->id.'/'.$name) $expensions= array("jpeg","jpg","png","docx","doc","pdf"); if(in_array($file_ext,$expensions)=== true){ move_uploaded_file($file_tmp,"../../site/assets/files/".$pp->id."/".strtolower($sanitizer->name($file_name))); $pp->pliki->add($file_name); } } $pp->save(); } ?> My input looks like this: <input type="file" id="pliki" name="pliki[]" multiple>
×
×
  • Create New...