-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
Categories not visible. Incorrect setup?
LostKobrakai replied to FrancisChung's topic in General Support
Often those accessable url's are used for the pages only showing a specific category, but you can surely prevent that. One way would be using only templates without a corresponding template.php file. If there's no file, then there's nothing to render, which results in the default 404 error. Another way would be using the right selector to get the categories $pages->find("parent.id=[path=/categories, include=unpublished]"). This does get you all children of the page found by the selector within the square brackets (subselector). Keep in mind, that urls are always lowercase. -
I'd really suggest storing this data separate to the map-marker data. In such a situation you don't want to depend on a tool you cannot surely control what data it spits out (changes to the module or the api).
-
PageNotFoundException leads to redecleration of _init.php functions
LostKobrakai replied to oap's topic in General Support
Just take a look at the files inside site-default folder at github. There's a _func.php and a _init.php, which are set up like I explained it. -
Implementing repeater into html page
LostKobrakai replied to kradzcalypse's topic in API & Templates
I'd suggest using this to create the foreach. It's less error prone than using brackets. <?php foreach($a as $b) : ?> … <?php endforeach; ?> The loop itself seems to ok, so maybe take a look at the output of this just before the foreach: <?php echo $page->PortfolioRepeater1->count(); ?> Also having <p> tags inside of <span> or <h3> is not allowed by html standards, so maybe correct this.- 1 reply
-
- 1
-
This in not documented, as I doubt this is meant to be often used by the enduser, but the source-code is quite fast to scan if you know the overall structure. Most of the seasoned pw users are simply using github or a local installation to lookup things.
-
PageNotFoundException leads to redecleration of _init.php functions
LostKobrakai replied to oap's topic in General Support
In the default profile it's included in the way I described, I'm not sure why it's otherwise in the beginner profile. -
You can try this: $fields->find("tags*=XXX");
-
You're not clear in your question. Are we talking about namespaces (a_title, a_body, c_body) or tagged fields, as of the tags to group fields in the backend?
-
PageNotFoundException leads to redecleration of _init.php functions
LostKobrakai replied to oap's topic in General Support
You're both probably including "renderNav()" somewhere in your _init.php. I wasn't sure about 404 exceptions, but I'm about $page->render(), where the init.php is prepended a second time within a single request, and one cannot create a function of the same name twice. I suggest moving helper functions in an own file and just include them in _init.php via include_once. This will make sure the function is never created more than once. -
This might also be of interest in that context: https://processwire.com/talk/topic/10176-processwire-issues-labeled-as-enhancement-on-github/?p=97180
-
The problem with such a qa team is that they would also get access rights to edit the repo (push to it) in GitHub, which is a fact Ryan doesn't seems to be overly keen on. In terms of dedicated permission management even GitLab is superior to GitHub, even if not by far.
-
<?php // First, confirm that a submission has been made if($input->post->contactname) { // Set a temporary upload location where the submitted files are stored during form processing $upload_path = $config->paths->assets . "files/contact_files/"; // New wire upload $contact_photo = new WireUpload('contact_photo'); // Reference field name in HTML form that uploads photos $contact_photo->setMaxFiles(5); $contact_photo->setOverwrite(false); $contact_photo->setDestinationPath($upload_path); $contact_photo->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // Second wire upload (other_photos) [NEW CODE] $other_photos = new WireUpload('other_photos'); // Reference field name in HTML form that uploads photos $other_photos->setMaxFiles(10); // Allow 10 other photos $other_photos->setOverwrite(false); // Use the temporary location set above $other_photos->setDestinationPath($upload_path); $other_photos->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $contact_photo->execute(); $other_files = $other_photos->execute(); // [NEW CODE] // Run a count($files) test to make sure there are actually files; if so, proceed; if not, generate getErrors() if(!count($files)) { $contact_photo->error("Sorry, but you need to add a photo!"); return false; } // Set up submissions in the ProcessWire page tree $np = new Page(); // create new page object $np->template = $templates->get("data"); // Set template for pages created from form submissions $np->parent = $pages->get("/test/"); // Set parent for pages created from form submissions // Send form submissions through ProcessWire sanitization and apply each to a template field for the new page $np->of(false); $np->title = $sanitizer->text($input->post->contactname); $np->name = $np->title; $np->contactname = $sanitizer->text($input->post->contactname); $np->email = $sanitizer->email($input->post->email); $np->comments = $sanitizer->textarea($input->post->comments); $np->save(); // Run photo upload for "contact_photo" foreach($files as $filename) { $pathname = $upload_path . $filename; $np->contact_photo->add($pathname); $np->message("Added file: $filename"); unlink($pathname); } // Run photo upload for "other_photos" [NEW CODE] foreach($other_files as $other_file) { $pathname = $upload_path . $other_file; $np->other_photos->add($pathname); $np->message("Added file: $other_file"); unlink($pathname); } // Save page again $np->save(); echo "<p>Thank you for your contact information.</p>"; return true; }else { echo "<p>Sorry, your photo upload was not successful...</P>"; } I've just gone though it and prettified the code. Also for line one: Do never put things right after "<?php". Not even comments. There has to be at least a space.
-
$file->description always returns the string "original"
LostKobrakai replied to bytesource's topic in API & Templates
Which version of ProcessWire are we talking about? -
There isn't any way, that I'm aware of, to archive what you want to do. The cache fieldtype also isn't meant to be used like this. It exists to improve database querying performance on multiple textfields and not really anything more than that. It's not intended to be shown anywhere.
-
$file->description always returns the string "original"
LostKobrakai replied to bytesource's topic in API & Templates
I suggest taking a look a these line: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Pagefile.php#L209-L220 -
I'm not sure if there are any specifics out there. The quote either way stands right as you've the ability to render whatever content you need in your templates. I'm not sure for mobile apps, but my half-knowledge would suggest that apps nowadays use json/rest endpoints, but you could also use xml to transfer your data. It really depends on the usecase.
-
I've to say, that I never got warm with Forklift. It tries to hard to be kind of a finder replacement, whereas Transmit just does one thing and that exceptionally well. The synced folder feature is just the best and if you set the local and remote startfolder for the favorites, than it works from the beginning and you just drag&drop files around.
-
Select Options Fieldtype (FieldtypeOptions)
LostKobrakai replied to ro-bo's topic in General Support
Seems like it, but there are few other unresolved ones in that function as well right now. -
Select Options Fieldtype (FieldtypeOptions)
LostKobrakai replied to ro-bo's topic in General Support
I'm not really sure how this is selecting 1|3 here, but there's certainly a lack in checking for empty strings in the FieldtypeOptions::sanitizeValue() function. To fix this add this right at the start of the function: if($value === ""){ return $this->getBlankValue($page, $field); } -
Are those pages "activeted" in the searched languages?
-
PageNotFoundException leads to redecleration of _init.php functions
LostKobrakai replied to oap's topic in General Support
I'm not sure, where you got that exception, but normally pw uses Wire404Exception() to throw 404 errors.