Jump to content

Francesco Bortolussi

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Francesco Bortolussi

  1. Hi. Have you checked the ouput format/HTML filters etc. applied to the textarea? (Just talking about obvious things)
  2. Hello. I need to create a page select type of field in a frontend Form The form is created using API: $formJob = $modules->get("InputfieldForm"); $formJob->method = "post"; ... And each field is created and added to the main form Object using corresponding Inputfield(X) module $field = $modules->get("InputfieldText"); $field->placeholder='NAME'; $field->attr('id+name','name'); $field->required = 1; $field->maxlength = 150; $formJob->append($field); The question is: How can I use the PageAutocomplete module in my form? I have tried adding a field as in the previous example: $field = $this->modules->get("InputfieldPageAutocomplete"); And setting the corresponding variables. Even included some JS files from Core: wire/modules/JqueryCore/jqueryCore.js ,wire/modules/JqueryUI/JqueryUI.js and the module JS file itself. But nothing happens, no ajax call, no jquery UI initialization, nothing. It is possible to use this inputfield outside the admin area/backend? Any help is appreciated.
  3. Hi, everyone. Is there a way to create a role with permission to translate PHP template files, like super user does in Setup->Languages. I'm implementing a multi lingual site and the translation of template files will not be made by me or any other superuser. Is there any workaround? I wish normal user could work directly in PW to make translations of template files. Thank's.
  4. Recently I was in trouble filling a repeater inside a foreach loop (Creating pages from a CVS File). One of the steps in my script was delete all existing pages before start creating new ones. Discovered that after using $page->delete() and create a new page I could't fill my repeater fields. Then if I use $page->trash() no problem, and the repeater's were created and correctly filled. What's the difference between delete and trash? Is there some internal pointer that get lost when delete() is called affecting the behaviour of the New() function or getNew()? The original problem is in this tread: https://processwire.com/talk/topic/11130-problem-addingpopulating-repeater-using-api/ Thank's.
  5. Guys I've got it. One of the steps I did before starting the creation of pages was delete them. Apparently: $delete = wire('pages')->delete($element); Differ's from: $delete = wire('pages')->trash($element); When I deleted the repeater's didn't get filled, but when I trash the element's they did correctly. Possible Bug? Why is this happenin'g?
  6. Agree with Soma, you just need to pass the right "Value" and the option field will be set correctly. $page->option_field='Exact_Option_Value';
  7. Hi, I'm trying to fill a repeater using a foreach and even using you'r Function approach Did your code fill all the elements of the repeater and saved them? I'm still getting this error : Error: Uncaught exception 'WireException' with message 'Can't save page 0: /1444384917-1926-1/: It has no parent assigned' in C:\wamp2.5\www\eelst\wire\core\Pages.php:1045 My initial code is posted here
  8. Hello, first thanks for this awesome project. My question is, I'm importing data from a CSV into pages whose template has a repeater, everything in the page fill's correctly(It even has images attached to it) but no repeater's are added. Something like page(song) -> repeater(videos of the song) I copied the code from http://processwire.com/api/fieldtypes/repeaters/ wich is the "Default" or basic way to populate a repeater using API. require("../../../index.php"); //Add processwire index (Bootstraping) $template = wire('templates')->get("song"); $parent = wire('pages')->get("/container-songs/"); //Array $rows_from_csv has been previously filled and is correct //The template has a repeater field called rep_videos foreach($rows_from_csv as $key=>$song) { //Start creating each page //$esiste = wire('pages')->get("template=canzone,title=$canzone[titolo]"); $p = new Page(); $p->of(false); $p->template= $template; $p->parent= $parent; $p->title=$key; $p->titolo=$song['title']; $p->testo=$song['text']; $p->description=$song['descrip']; $i++; //Load the repeater for each video the song has foreach ($song['videos'] AS $v) { if ($v<>'') { $i++; $repeater = $p->rep_videos->getNew(); $repeater->title="$key-$i"; $repeater->video_url = 'http://www.youtube.com/watch?v='.$v; $repeater->save(); $p->rep_videos->add($repeater); $p->save(); } } } Maybe the problem is that the code segment is inside a foreach? I've tryed different approaches, like saving the page before the loop that try to creates the repeater but returns an error: Error: Uncaught exception WireException with message Can't save page 0: /1444373775-0463-1/: It has no parent I've tryed saving the page after the foreach so each element of the repeater remain's in memory until finish adding new element's (Video url in this case) with no positive results. Even tryed to create the repeater of the foreach using literally the code from Repeaters Page Any help will be appreciated.
×
×
  • Create New...