-
Posts
75 -
Joined
-
Last visited
-
Days Won
2
TomPich last won the day on May 12
TomPich had the most liked content!
About TomPich
- Birthday 02/26/1976
Contact Methods
-
Website URL
https://www.situp-webcreation.com
Profile Information
-
Gender
Male
-
Location
Strasbourg
Recent Profile Visitors
621 profile views
TomPich's Achievements
Full Member (4/6)
69
Reputation
-
Thanks! 😊 I’ll check if that solves my in the StdanradPage class.
-
Hi there, I know there are several posts about this subject, but they provide the answer I’m looking for. I’m working on a website on which some data as to be read and/or stored in an external database (which is also accessed by another app). What’s the cleanest way to achieve that? My first idea was to exclusively use DefaultPage class. Something like: class DefaultPage extends Page { private \PDO $dblfa; public function __construct(Template $tpl = null) { parent::__construct($tpl); global $config; $this->dblfa = new \PDO("mysql:host=" . $config->lfa_dbHost . "; dbname=" . $config->lfa_dbName . "; charset=utf8", $config->lfa_dbUser, $config->lfa_dbPass); } public function getParticipants() { $request = "SELECT * FROM participants"; $query = $this->dblfa->query($request); $items = $query->fetchAll(\PDO::FETCH_ASSOC); $query->closeCursor(); return $items; } } But this generates some subtle bugs : in front: $pages->get(...some ID...) returns null (only when the DefaultPage class defines $this->dblfa, otherwise it works fine). in admin: one of the page, with over 300 children, returns PagesLoader: SQLSTATE[08004] [1040] Trop de connexions [pageClass=ProcessWire\DefaultPage, template=un_inter] (un_inter is the child template) So I want for this solution: In site/config.php $config->dblfa = new \PDO("mysql:host=" . $config->lfa_dbHost . "; dbname=" . $config->lfa_dbName . "; charset=utf8", $config->lfa_dbUser, $config->lfa_dbPass); In site/classes/DefaultPage.php class DefaultPage extends Page { public function getParticipants() { global $config; $request = "SELECT * FROM participants"; $query = $config->dblfa->query($request); $items = $query->fetchAll(\PDO::FETCH_ASSOC); $query->closeCursor(); return $items; } } It works perfectly, but it doesn’t feel “clean” for me. I’d like to handle all the external database logic in the same file (ideally DefaultPage.php as I will need to implement some methods, so init.php would not be the best in my very limited knowledge). Both solutions actually fetch the data, no problem with that. Anyone to shed some lights about that? Thanks guys.
-
Hello, I would create a template with the sidebar content fields (without PHP file associated, as it is not intended to be displayed as a page), and create a page (let’s call it sidebar-page for our discussion) with this template. Then, in your post template, just call the content of your sidebar-page, something like $sidebar = $pages->get({sidebar-page-id}. Then you can use any field of this page in your post. Hope my explanation is clear enough... 😊
-
Hi @mel47, I would split the string with duplicate dates into an array, then use array_unique to get rid of them, then join the array into a string
-
page disappears in frontend when link changes (url not updated)
TomPich replied to floko's topic in Getting Started
Welcome @floko, I don't really get your problem. What is the link url you’re supposed to get when using contact persons? What is the response code of this blank page ? -
Hello @dan222 and welcome to this forum! To push a site online : go to your db manager on laragon and export your db as a sql file then, from your hosting control panel, create a db (or empty it if it already exists) and import your local db with FTP, copy your local files in your hosting folder for your site (don’t forget to change the database config in /site/config.php file) And that’s all. ? Now, you can be a bit more efficient by using an "if" statement for your database config, so that you don’t have to worry about changing them when you push your site online (see below) using ssh/rsync to synchronize your local and distant files I’m sure you can optimize database export/import too, I didn’t dig in yet... // db config online / on localhost if ( $_SERVER["HTTP_HOST"] === "my-online-url.com") { $config->dbHost = '...'; $config->dbName = '...'; $config->dbUser = '...'; $config->dbPass = '...'; } else { $config->dbHost = 'localhost'; $config->dbName = 'my-local-dbname'; $config->dbUser = 'root'; $config->dbPass = ''; } $config->dbPort = '3306'; I generally need 4 minutes to pull or push a website after or before working on it, if it involves db update. If it’s only changes in files, it’s done in 10-15 seconds.
-
Just want to paste in Google Tag code. Why is it so hard ?
TomPich replied to JCVinso's topic in Getting Started
Hey @JCVinso, Your admin looks perfectly normal. You see all the pages of the website. From there, you can edit them (hover → edit button). Can you explain what do you want to achieve? What can of options do you expect to see in the admin? -
I also like to give my clients some links to articles about PW : Article on PW by IONOS Article on PW by London web agency Net Dreams Article on PW by British web agency Presto ProcessWire vs WordPress on cmscritic.com And nice websites built with PW : Australian Antartic Program Nienburg Mittelweser Peggy Guggenheim Collection Herzzentrum Bonn Austrian Bankers Association BMW Dealersites University of Florida / IFAS Assessment and hundreds of others on this page.
-
Thanks @Neue Rituale, I’ll try that right away.
- 8 replies
-
- fieldtype
- inputfield
-
(and 2 more)
Tagged with:
-
Will definitely try this module ?
-
Hi @d'Hinnisdaël, Just wanted to say (again) how awesomissimo is your module. It’s a real asset in the scale when trying to convince a client to switch from WP to PW. They often fear to be lost with a new admin interface. But thanks to Dashboard, I can demonstrate how easier it is. ?
-
Hi guys, I was wondering if the action buttons for each page in page tree could be : All always visible (always immediately see Hide, Unpublish, Trash... when hovering over page link) Hidden selectively even if the action is possible (like always hide the Lock button) About the Add new button, I noticed something that is a bit weird : Let say I have a P template that may have children based on template C1 and C2. C1 and C2 can only have P as parent. So these conditions are enough to get a link with the "Add new" button, and it works perfectly. Now, let’s imagine I have two roles defined : chief-editor and contributor. Chief-editor can create pages based on C1 and C2 and can see both "Add new" links. Contributor may only create pages based on C2. They should only see "Add new C2" link. But they actually can see both links, and when they try to create a C1 page, they get an error saying "ProcessWire: ProcessPageAdd: Template page-post is not allowed here (/p-page-url/)". Which is absolutely right, as they are not allowed to create C1 pages. But it’s confusing for the user. Did I misconfigure something here? Or is it something that should be fixed?
-
Very old indeed, but still useful... and still working ? Who said plugins needed to be updated every week ? Oups... wrong forum... ? I’ll open an issue on Github.
-
Hey there, I had the same need (hide page tree for certain roles). Used https://processwire.com/modules/admin-restrict-page-tree/ module. Worked like a charm, except that I had the same problem than @DL7, i.e. the bread crumbs provide links to the page tree. The page tree is not displayed, but a page saying "Login" with an "Edit profile" button is shown. That may be a bit confusing for users. So I add a few lines to the module, in order to optionnaly skip the bredcrumbs rendering (a hook, and a checkbox to choose whether you want to display the page tree for restricted users). It works well with AdminThemeUikit (I didn’t test it with the default admin theme). I thought this might be useful to other users. @Wanze, @netcarver if you want to have a look at it, maybe for module update? It would be my first contribution to a PW module... ?
-
Sounds great. It would cover my needs. Do you treat these users as PW users? Or did you make a kind of "front user" profile using a custom template? In the last case, i wouldn’t be so sure on how to handle security matters and sessions.