-
Posts
635 -
Joined
-
Last visited
-
Days Won
6
Everything posted by rick
-
Shoutout to @matjazp! Thanks for all your help!
-
You can check out the blog module. It will handle the article content and related info. As far as the front-end looking like other magazine layouts, there are numerous free magazine html/css templates and more paid templates. You may want to consider a paid template. The free templates look like free templates. ?
-
Basically reiterating @wbmnfktr a Table is semantic while the DIVs are not. There a quite a few google search results for css div tables dating back to '08 where others have attempted replicating the html table using div elements. The main issue nowadays is the device screen sizes. Tables don't scale well at different resolutions. That being said, css has display:table, display:table-row, and display:table-cell type attributes, as well as using pseudo selectors like :last-child to reference specific elements. You could also hide specific table columns at different resolutions. I know this isn't the answer you were looking for, but maybe it helps with segregating large datasets into manageable chunks.
-
Payment related Project, opinions, hints, all much appreciated
rick replied to olafgleba's topic in General Support
Hello @olafgleba , What a fun project to work on. Reading through your post a couple of times it is clear you have everything under control, but simply have a question about processing payments for this parent (registration) -> child (art schools) relationship. First, I have no experience with padloper or formbuilder to say whether they can handle multiple vendors with multiple products. I'll leave that for the more experienced members. Lastly, I would contact stripe support and ask them the best means to handle multiple merchant accounts from a single URL (registration). This is where I think issues will arise. Normally you would define a single URL in the merchant account setup. But your solution would mean that you (registration) would also provide one or more merchant ids for each transaction. Stripe support will be able to answer that. I hope this helps. Also, keep us posted on this project (if allowed). -
Typography is not a simple topic but I'll try to explain how I use it. But first, the difference between EM/REM. Generally, an EM got it roots in print where it refers to the width of the upper-case M. When css came about, they changed it to refer to a relationship of the parent element. By default, one EM generally is 16 pixels in the browser world. The REM (Root EM) is in relation to the root (usually the HTML definition if no ::root{} is defined) font size as you have defined in CSS. Some inconsistency -- You can use both EM and REM in margin/padding definitions. However, when using EM as the unit in a margin definition it looks only at the current element; It does not refer back up to a parent. This is not the case with REMs. The REM declaration is always looking at the root. // EM html { font-size: 16px; } article { font-size: 20px; } p { font-size: 1.1em; margin-bottom: 1em; } <article> This is 20px. <p>This is 1.1 x 20px. The bottom margin is 1.1em regardless of parent font size setting.</p> </article> // REM html { font-size: 18px; } article { font-size: 20px; } p { font-size: 1.1rem; margin-bottom: 1rem; } <article> This is 20px. <p>This is 1.1 x 18px. The bottom margin is 1 x 18px.</p> </article> The viewport width/height (VW/VH) allows for a 'fluid' scaling. However, the drawback is that smaller devices will not zoom in or out should the font size scale too small. Also, on very wide screens this scaling would likely make the text way too big, to the point of interfering with other content. My method: I define my base font size as 16px (usually the browser default). I also include variables to make future changes very simple. I put my font size break points at the top of my css file (usually after ::ROOT{} ) so that I don't have to go hunting should I need to change something. To avoid the confusion between parent references, I define all font sizes, margins, paddings, widths, etc. in REMs, except for the base ::root{} definition which is in pixels. :root { --fs-norm: 1rem; // defaults to browser's font-size definition --fs-big: 2rem; --fs-hdg: clamp(3.5rem, 10vw + 1rem, 14rem); // This sets the min and max font-sizes and scales in between } @media (min-width: 40rem) { :root { --fs-norm: 1.125rem; --fs-big: 3rem; } } body { font-size: var(--fs-norm); line-height: 1.6; } h1 { font-size: var(--fs-hdg); text-transform: uppercase; } I hope this helps. Like I said, this isn't a simple topic where you can say, "Use x because...". ps. Not a front-end guru so others may have a better reply.
-
Maybe I'm off base here, but since you say the user is the issue, why not create your own ISAM routine by hooking the registration to it's own domain/database and passing the result to the proper installation login/user.
-
Should custom forms be built with the ProcessWire Form API?
rick replied to Jonathan Lahijani's topic in General Support
Personally, I prefer the old-school way rather than the ProcessWire way simply because it becomes too cumbersome to use ProcessWire to create Admissions forms, Tax forms, Milspec forms, Aircraft maintenance forms, etc. which I do almost monthly. I did begin with the ProcessWire way and spent way too much time trying to get the layout correct on both the front end and back end, so I stopped using its forms. As you know PHP has some built-in validation such as email, url, dns, etc. The remaining form types are simple enough to validate manually (ie, not using ProcessWire). Don't get me wrong, ProcessWire is great for the majority of solutions I require and I use it as the base for all current projects. But Ryan built it to satisfy his requirements, which don't necessarily meet with our requirements 100% of the time. When I create complex forms I use css grid and flexbox with custom styles to achieve the necessary front-end layout -- I don't allow user access to any back-end forms. Custom javascript is sometimes required to validate some form elements client side, including ajax calls, but it is nothing major. Also, I don't have to bloat my forms by including one or more third-party javascript libraries. If I receive a request for a simple form such as a contact form, then yes, I use the ProcessWire way. Otherwise, I find it much simpler to do it the old-school manual way. -
Add public / web directory to $config->paths
rick replied to SwimToWin's topic in Wishlist & Roadmap
The config->paths->root also contains the current process as part of the path. For example, if you are currently within a custom process module named 'widget', then the returned path is '/path/to/docroot/widget/'. You could use a combination of string functions with DOCUMENT_ROOT, CONTEXT_DOCUMENT_ROOT, and SCRIPT_FILENAME values to validate the directory. As far as I know, the script_filename value is not vulnerable so should provide a base from which to test and extract the doc root with some confidence. -
Wow! Thank you! I was hoping for a suggestion where to look, not a complete working example. That is the cool thing about you, @Robin S, you are always above and beyond anyone's request for assistance. Much respect!
-
Ok, apparently the term 'PATH" means the complete filespec (path + file). I still cannot get the allowedPath parameter to accept any entry. It always uses /site/template. I did however get this to work by providing the filespec as the first parameter. So from my first example, $file = "somefile.php"; $path = $this->wire('config')->urls('siteModules')."myModule/includes/"; $filespec = $path . $file; $result = wireRenderFile($filespec); return $result; works just fine, so I will mark this topic as solved. Can anyone reproduce this behavior? Just checking to see if this is a bug or my stupidity. ?
-
The error is thrown from the wire/core/TemplateFile.php:171'/site/templates/somefile.php'. line 170 public function setFilename($filename) { bd($filename); // Shows invalid /site/templates/somefile.php if(empty($filename)) return false; if(is_file($filename)) { $this->filename = $filename; return true; } else { $error = "Filename doesn't exist: $filename"; if($this->throwExceptions) throw new WireException($error); $this->error($error); $this->filename = $filename; // in case it will exist when render() is called return false; } }
-
I thought so as well. I tried with both urls and paths. I get the same error stating templates but tracy shows the path is correct.
-
Howdy! I've been exploring using the wireRenderFile() function in a test module. I keep getting one error or another depending on how I attempt to render the file. According to the api doc one of the default paths is /site/modules/. In this directory I have my module, which has a sub directory for files to be rendered as needed. $file = "somefile.php"; $path = $this->wire('config')->urls('siteModules')."myModule/includes/"; $result = wireRenderFile($file, array(), array('allowedPaths' => "$path")); return $result; // Error: Filename doesn't exist: ***/site/templates/somefile.php It appears that wireRenderFile is not accepting the allowedPaths option. Tracy dump shows $path = ***/site/modules/myModule/includes/'. Any ideas on what I am overlooking? See last posting.
-
Thank you @adrian, I did not see that. I appreciate you locating that topic. I have it saved for future reference. In the meantime I came up with a workaround where I don't have to modify a user's ready.php file during install.
-
This is still an issue. I cannot select a user from an auto complete select on an admin form. Even with the hooks @adrian and @bernhardsuggested in this reported issue. My select field is configured as follows: Page field value type = single/false (other options make no difference). Allow unpublished pages = checked. Type: Page auto complete. Template = User. Selector string = template=user, include=all, check_access=0, sort=name. Label field = name. When attempting to edit a page with this field this is the resulting selector: template=user, sort=title, templates_id=3, title%=sca, limit=50 *Notice the duplicate template reference. This obviously is a core issue. The resulting query is: SELECT SQL_CALC_FOUND_ROWS pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN field_title AS field_title ON field_title.pages_id=pages.id AND (((field_title.data LIKE '%sca%' ) )) LEFT JOIN field_title AS _sort_title ON _sort_title.pages_id=pages.id WHERE (pages.templates_id=3) AND (pages.templates_id=3) GROUP BY pages.id ORDER BY _sort_title.data LIMIT 0,50 Two issues with this query; 1) there are no user names present in the field_title.data column, 2) the join statement has three levels of parens, which are obviously leftover from from whatever concatenation function that was previously performed. This again is a core issue. All of my projects rely on selecting a user at various steps. Can anyone provide a workaround, or tell me what I have done wrong? I appreciate your input.
-
Is this for the front-end? If yes, You can write your own login routine that will check against the user data (additional field denoting selected client). Once verified, redirect to the desired page. Since you don't want users to register themselves, you can add a link to your login page (similar to contact us) where potential clients can request an account. The request is emailed to the admin for processing. Just a thought.
-
Just tossin' more info in the thread... https://github.com/salsify/jsonstreamingparser https://www.jsonfeed.org/version/1.1/
-
How can I make a Process available to a non-superuser?
rick replied to DrQuincy's topic in Module/Plugin Development
N/A -
New page '//' must be saved before files can be accessed from it
rick replied to rick's topic in General Support
Hi @Zeka, Thanks for the help. I can check whether the page is present or not. The issue is imho one of consistency. Let me elaborate... Only the 'file' field types have this 'gotcha'. For example, in PHP the procedure is as follows: Create a form User completes the form and submits (including any uploaded files) Data is then sanitized, uploaded tmp files are moved, and data written to the database or The user cancels the operation Data and form are destroyed The PW way: Create and save some dummy page Create a form User completes the form and submits (including any upload files) Data is then saved and files are moved to that page asset or The user cancels the operation (No cancel function, so navigate away) Data and form are destroyed *Page is now orphaned* You get the notice that a page with that name already exists when attempting to create another page. Interesting is that page doesn't have a title field (which is required). Using any other field type, I can perform the following procedure within my process module: Create a form User completes the form and submits Page is saved with user data and user is redirected to previous page The steps are: 1) Create blank new Page. 2) Assign Parent. 3) Assign Template. 4) Build form from Page->getInputFields() or User cancels operation Data and form are discarded and user is redirected to previous page The problem is pre-defining a page just so an empty input field has a reference before any data is provided. This only occurs when there are 'file' fields present in the template. -
New page '//' must be saved before files can be accessed from it
rick replied to rick's topic in General Support
Did I miss something? ? -
Howdy y'all, I have created a set of fields via the api, added them to a fieldgroup, then assigned that fieldgroup to a template. One field is FieldtypeImage. When I attempt to create a form using $page->getInputFields() the following error is displayed, New page '//' must be saved before files can be accessed from it This only happens when fields relating to files are present. All the other field types are created correctly on a form. How can I 'bypass' this 'must be saved' issue?
-
Best practice for ajax requests (where to put the ajax templates)
rick replied to Stefanowitsch's topic in General Support
Howdy @Stefanowitsch, Have a look at this topic. Maybe it will help.