-
Posts
1,070 -
Joined
-
Last visited
-
Days Won
16
Everything posted by dotnetic
-
@Nvim I never said it is accurate: There is no accurate way to detect how many installations there are. Some people (like myself) are even building applications with ProcessWire which are not publically available.
-
Help needed: Link to or search in multiple fields
dotnetic replied to Hajosch's topic in Getting Started
First of all I want to say that learning PHP is crucial to get going with ProcessWire. You should understand the basic syntax and concepts and how to iterate over items. Please also read http://processwire.com/docs/tutorials/but-what-if-i-dont-know-how-to-code/ However, you should create a template file "authordetails.php" in site/templates/ directory, then in ProcessWire admin also create a template with the same name (but without the .php suffix). Then assign this template to each author and editor. In the authordetails.php file enter the following code to get all publications for this author/editor: $publications = $pages->find("template=publication, authors|editors={$page->id}"); Please note the double-quotes, that are required for {$page->id} to work!!! If you are using a more recent version (3.0.107) of ProcessWire you could instead use $publications = $page->references(); please read http://processwire.com/blog/posts/processwire-3.0.107-core-updates/#page-gt-references about this. Then iterate over the publications foreach ($publications as $publication){ echo $publication->title; } All this is completely untested and comes directly from my brain, so I hope everything works. -
Help needed: Link to or search in multiple fields
dotnetic replied to Hajosch's topic in Getting Started
If I understand you correctly you want to display a list of all publications, where the author OR the editor is = the name that you clicked? For this you would need a selector like $publications = $pages->find('template=publication, authors|editors%=name_of_the_author'); Please take a look at https://processwire.com/api/selectors/#or-selectors1 how to use OR selectors. Please also note, that you have to use $pages, instead of $page and "find" instead of "get" to find the correct pages. $page is the actual page you are on, and queries the fields you mentioned on the actual page. $pages->find performs a search on all pages that match your selector and returns the result. You then have to iterate through the result, to display all books/publications of that author/editor. -
Please take a look at the thread and also https://publicwww.com/websites/"X-Powered-By%3A+ProcessWire"/ but it tells only a part of the story, as it can not list all sites, because some sites turn off the x-powered-by header.
-
[SOLVED] Add class to FieldtypeTable before outputting it
dotnetic replied to dotnetic's topic in API & Templates
Thanks @Soma, this works fine. Maybe it is a solution for other fieldtypes I have too. -
[SOLVED] Add class to FieldtypeTable before outputting it
dotnetic replied to dotnetic's topic in API & Templates
@kongondo This also doesn't work. @OLSA This won't work because it is a FieldtypeTable and not a FieldtypePageTable, as you can see in the screenshot: -
[SOLVED] Add class to FieldtypeTable before outputting it
dotnetic replied to dotnetic's topic in API & Templates
Sadly $inputfield->addClass() does not work. -
[SOLVED] Add class to FieldtypeTable before outputting it
dotnetic replied to dotnetic's topic in API & Templates
I found a way with str_replace, but I think this is not the best way. Here is what I added to my getFieldValue function: if ($fieldType == 'FieldtypeTable') { $value = str_replace('ft-table', 'uk-table', $value); return $value; } Suggestions, how I can do it better? -
[SOLVED] Add class to FieldtypeTable before outputting it
dotnetic posted a topic in API & Templates
How do I add a class "uk-table" on the frontend to a FieldTypeTable? I am iterating through all elements from an admin template and eventually modify the values (for example concatenate the values of a Page field with a comma), but I don't know how to add the class to the table. The code that I am using right now is in a gist at https://gist.github.com/jmartsch/768d9dc19293528fe9ae82b7a8ee1c42#file-home-php In line 15 https://gist.github.com/jmartsch/768d9dc19293528fe9ae82b7a8ee1c42#file-home-php-L15 I tried to hook into the rendering, but as it is no Inputfield anymore, the hook does not work. Can someone help me please? -
It would be nice, if this theme would be selectable as an option on the user profile page instead of replacing the standard Uikit theme. An option to use the normal unmodified AdminThemeUikit would also be good in my opinion.
-
Or even easier with $session->redirect("/user-profile/$user->name");
-
Hey @tpr there are settings in AoS for PageListTweaks: Always show pagelist actions and Always show extra actions. Could you make them work also in a ListerPro? I can confirm this bug.
-
How to render admin page into a variable to create a PDF?
dotnetic replied to dotnetic's topic in General Support
Thank you all for your insights and information. Most people think, that it would not be a smart thing to render the default admin markup. However I am still evaluating options and trying out different things. Thanks @Robin S for his code. At a later time I would like to get an export of many PDFs (100 or 1000, I don't know yet, how many my customer would handle). I tried to find the perfect tool for generating the PDF. I tried WeasyPrint (written in Python) which has very good rendering capabilities. The problem is, that I have to call it from PHP via exec(), and it gives no feedback or errors. Additionally WeasyPrint requires an URL or a file to render to PDF, but does not know anything about my login status in ProcessWire. As my PDFs and pages are protected and should only be visible to logged in users, this is not a real solution ? Another problem is performance. The generation of 100 PDFs from pages would take a long time. First the page with over 150 fields has to be rendered and then the PDF has to be created. Multiply the time with 100 and you are waiting a looooong time. So right now, I think I use the Pages2PDF module which generates a PDF for a page on save and saves it to disk. As a template for the PDF I will try Robin's code to iterate through the Inputfields and get a clean output. When a user then wants to get an export of all PDFs, I just have to gather the files and zip them or combine them into one PDF. This would be really fast. What do you guys think about this approach? -
How to render admin page into a variable to create a PDF?
dotnetic replied to dotnetic's topic in General Support
They are regular admin pages. Then in a module I would like to add a button that gathers the HTML of the admin pages and generates one or multiple PDFs out of it. -
How to render admin page into a variable to create a PDF?
dotnetic replied to dotnetic's topic in General Support
I have seen Adrian's answer but to hook into the rendering, I need to render the page, as you did in your example. The problem with your example is, that it does not get the HTML of the admin page, but instead of a template file that resides in site/templates. But I need the HTML from the admin page. -
How to render admin page into a variable to create a PDF?
dotnetic replied to dotnetic's topic in General Support
But my main question remains: How do I get the HTML of the admin page? Most important is, how do I get it when I am not actually on the page. Because I want to get the HTML of multiple admin pages. -
How to render admin page into a variable to create a PDF?
dotnetic replied to dotnetic's topic in General Support
There are different libs out there which convert existing HTML and CSS to a PDF. If I create a Bitmap graphic out of the website, the PDF would not be searchable. So converting to a bitmap is not a solution for me. Looping over the fields and generating own markup would be the exact same process as if I did it on the frontend. I have to take every single fieldtype into account and render it accordingly. This is one thing ProcessWire's admin already does. Although this solution would be a lot cleaner with simpler HTML. Then I would create an own stylesheet and generate the PDF out of it. As I said before, I would not like to do this. But it might be an option. -
How to render admin page into a variable to create a PDF?
dotnetic replied to dotnetic's topic in General Support
@bernhard I try to generate PDFs of one one or more admin pages (forms). I built an application with PW where people can enter details (for example a job application or a request form for office material) and there are many fields (150+) in the admin. Also in the admin I ordered and positioned the fields like they should appear on the resulting PDF. So I do not want to make a new template on the frontend level, just to recreate what I already have in the admin. If fields are added I have to change nothing. So I hope to come up with a good solution. I already seen your RockPDF module, and also Pages2PDF and PDFcomposer. Thanks for the additional hint. -
How to render admin page into a variable to create a PDF?
dotnetic posted a topic in General Support
I want to create PDFs of certain pages in the admin. I do not want to recreate the admin template on the frontend and write code to show every field that I have in my template. Instead I would like to get just the HTML of the admin page in a variable so I can use it for generating my PDFs. How would I do that? Can it be done via API? Or use ob_start to capture the output? -
Get well soon Ryan.
-
I really love your Theme but I don't know if it is right to use it because the Uikit version you use, is outdated. Right now there is a RC17 version. Also I think Ryan made some additions in the AdminThemeUikit, do you plan to be on par, if something changes or is added?
-
Add optional label beside integer fieldtype
dotnetic replied to Juergen's topic in Wishlist & Roadmap
I had the same request, and wanted to create a new Inputfield at first. But I think we could see this in a more general manner. It would be nice if we could have field prefixes and suffixes, and also can choose if they are displayed as icons or text. Uikit has some options at least for icons: The icons can even be clickable, you can read about it in the docs: https://getuikit.com/docs/form#form-and-icons I would love to see support for suffixes and prefixes for most inputfields in the core. Me and some other guys like @bernhard are also building applications in the backend and this would be a good addition. Maybe we should open a ticket on github? -
This is not intuitive. What does a red header mean? It could be anything. A timer that reads "Time until logout: 10 sec." would be the best from a UX perspective.
-
[SOLVED] Best way to assign properties but each properties only once
dotnetic replied to dotnetic's topic in General Support
@bernhard I would like to do this if someone comes up with a good name for this module *wink*