-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
Situation where I need set a value for a page selected from a pagefield
adrian replied to Gabe's topic in General Support
And also maybe the Profield Page Table may help. Keep in mind that the link gebeer added here is to Profields Table, which is very different to Profields Page Table. Also, note that the latter is in the core of PW 2.5, just not installed by default. -
Take a look at the PageTable field type available in PW 2.5. It's in the core, but not installed by default. Also, look at the excellent extended version: https://processwire.com/talk/topic/7459-module-pagetableextended/ Oh, and welcome to the forums!
-
Try: $header_image = "<img src='$header_image->first()->url' alt='$header_image->first()->description' />"; An image field behaves as an array so you need to specify which image: http://processwire.com/api/fieldtypes/images/
-
Small update committed for finer control over the overwrite option when importing. The new table-csv-import-overwrite permission allows you to control access to the overwrite option when importing. If a user doesn't have this permission, they won't have the option to choose overwrite. The overwrite option is also controlled at the field level. Go to the table field's Input tab and check the new "Allow overwrite option" if you want this enabled at all for the specific field. So if overwrite is not enabled for each particular table field, it doesn't matter what permission the user has, no-one will have access to it.
-
To explain another way, $a .= "Hello"; is the same as: $a = $a . "Hello";
-
PW 2.4, role/permission not displaying copy button in tree
adrian replied to PascalKonings's topic in General Support
Just a guess - is it possible that the access control settings on the parent template don't allow the publisher role to create children? Does it work as expected for a superuser? -
I was confused by that which is why I hadn't commented yet - I was trying to let it sink in to see if I could get what you meant I should probably do a little more cleaning of the CSV for trailing commas, extra spaces, and the like - it's on my list.
-
Love it diogo! The video is awesome! Big muesli and granola fan here, so if I ever make it back to Portugal, I'll visit for sure! PS Shouldn't the links to http://ppl.com.pt/ go direct to your campaign?
-
This module adds CSV import and export functionality to Profields Table fields on both the admin and front-end. http://modules.processwire.com/modules/table-csv-import-export/ https://github.com/adrianbj/TableCsvImportExport Access to the admin import/export for non-superusers is controlled by two automatically created permissions: table-csv-import and table-csv-export Another permission (table-csv-import-overwrite) allows you to control access to the overwrite option when importing. The overwrite option is also controlled at the field level. Go to the table field's Input tab and check the new "Allow overwrite option" if you want this enabled at all for the specific field. Please consider limiting import overwrite option to trusted roles as you could do a lot of damage very quickly with the overwrite option Front-end export of a table field to CSV can be achieved with the exportCsv() method: // export as CSV if csv_export=1 is in url if($input->get->csv_export==1){ $modules->get('ProcessTableCsvExport'); // load module // delimiter, enclosure, file extension, multiple fields separator, names in first row $page->fields->tablefield->exportCsv('tab', '"', 'tsv', '|', true); } // display content of template with link to same page with appended csv_export=1 else{ include("./head.inc"); echo $page->tablefield->render(); //render table - not necessary for export - just displaying the table echo "<a href='./?csv_export=1'>Export Table as CSV</a>"; //link to initiate export include("./foot.inc"); } Front-end import can be achieved with the importCsv() method: $modules->get('TableCsvImportExport'); // load module // data, delimiter, enclosure, convert decimals, ignore first row, multiple fields separator, append or overwrite $page->fields->tablefield->importCsv($csvData, ';', '"', true, false, '|', 'append'); Please let me know if you have any problems, or suggestions for improvements. Enjoy!
-
Thanks horst - I may implement this, but I am still hoping that Ryan will fix what seems to be confusing behavior, or is it just me?
-
Using a different field to generate page URLs
adrian replied to statestreet's topic in API & Templates
$this->pages or wire('pages') ->find(...... -
iframes are being stripped from CKEditor field, even when explicitly allowed
adrian replied to wes's topic in General Support
Yeah - it definitely works fine it 2.5 - hopefully Ryan will get around to updating the supported versions for it shortly. -
iframes are being stripped from CKEditor field, even when explicitly allowed
adrian replied to wes's topic in General Support
Quick answer - if your only need for iframes is video embedding, then use this instead: http://modules.processwire.com/modules/textformatter-video-embed/ -
But I don't think you want to call them individually - what if you decide to add a 4th image at some point - then you'd need to change your code to add: ->eq(3). Best bet is to do what kongondo suggested: foreach($page->slider1 as $img){ echo "<div class='item'><img src='{$img->url}' /></div>"; }
-
have DB error with de/installing modules in fresh Install
adrian replied to horst's topic in General Support
Hey horst - sounds like we are both having similar issues at the moment I had the same thing yesterday and it was just about properly removing the admin page on uninstall. Not sure how you have set up the page, but this worked for me: $moduleID = $this->modules->getModuleID($this); $page = $this->pages->get("template=admin, process=$moduleID, name=" . self::adminPageName); That works based on defining this constant early on: /** * Name used for the page created in the admin * */ const adminPageName = 'table-csv-export'; -
I am also struggling with this a little at the moment. If the parent has requires and installs set to the child module I can install the parent and have the child install. Also it prevents me from uninstalling the child directly (which I want), but when I go to uninstall the parent, it can't uninstall the child automatically because the parent needs it at the point of uninstall still. If I remove the requires from the parent, then the parent can uninstall the child, but then someone could also manually uninstall the child, which I would like to prevent. Is this possible?
-
how to use jquery / javascript code online version in pw?
adrian replied to lord_dupalski's topic in Getting Started
How do you know it's not loaded? Try adding this below the call to jQuery <script> if (window.jQuery) { alert('jQuery is loaded'); } else { alert('jQuery is not loaded'); } </script> -
How to get unique field values from a nested foreach
adrian replied to NooseLadder's topic in General Support
$categories = $categories->unique(); -
Just a small update that adds some nice default styling to the login form. It populates the CSS field on install so you can still edit however you want, but gives a much nicer starting point If you have the module already installed, you'll want to update, then uninstall and reinstall to populate the CSS field. It now looks like this by default:
-
Hey horst - I am not really up on the latest with this, but just to give you an idea, I can get a successful test with gmail with only: smtp.gmail.com 587 use START_TLS with no credentials entered at all. Not sure if this is unique to gmail. I agree though, I thought most SMTP servers required authentication these days. It seems that gmail doesn't actually send a message, but the test is still successful without. BTW, the settings that actually do send an email via gmail for me are: smtp.gmail.com 465 use SSL email and password as credentials NB: I actually need to turn off use START_TLS
-
I had a similar situation the other day with a gmail smtp setup. The test connection worked fine, but the email didn't send. Turns out the test worked with a few different config setups, but the email only sent with one specific setup. So I think a successful test connection is not always a guarantee that everything is set up correctly. Not sure that your module can do anything about that though.
-
I am not totally sure why you have the child Home page. If it's just to get it to appear in the front-end menu, then there are much better ways. $homepage = $pages->get("/"); $children = $homepage->children; $children->prepend($homepage); foreach($children as $child) { $class = $child === $page->rootParent ? " class='active'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; }
-
I don't think you can change that setting in your template because it is already loaded. I think the best approach is to add the following to the top of the template file that is being appended. if($config->ajax) return; or instead you could use: if($useAppended) return; and then in your template files you could do: if($config->ajax) $useAppended = true; Lots of options really
-
Check out the image version, also from blad: https://processwire.com/talk/topic/7379-module-alternativegridimages/
-
I am still not 100% clear, but it sounds to me like maybe you don't want a new way of storing product/price info, but just a new way of entering it. It sounds like you still want the data stored in the product's page fields. Is that correct? If so, you might be looking at implementing something custom with AdminDataTable (core module often used by other modules), or HandsOnTable. Here are a couple of links for inspiration: http://modules.processwire.com/modules/data-table/ https://processwire.com/talk/topic/4147-excel-like-crud-in-pw-using-handsontable/ and of course the ProTable field type. I think with ideas from those you could build a process module that builds an editable table using the product/price info from the fields from product pages. When saving the table, the data would be written back to the appropriate pages. Am I on track at all?