-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
160
Everything posted by kongondo
-
Reviving this old topic.... For pages created in bulk using the API, many will have the same timestamp (e.g. batch create 1000 pages using the API); the only unique thing for such pages will be the ID. If I limit my selector to one template only, the ID then becomes a more reliable get selector to use with < or >. The assumption here is that since IDs are incremented, a greater ID denotes a later created time. In bulk page creation then, the timestamp is less reliable and will return the same result every time which is of no good use when creating next/prev links ...maybe I'm missing something?
-
It seems you unpublished the page? You are in the backend, one that only you can see, why does it matter to see a pretty URL? OK, what is happening is this. When 'viewing' a page like the one you've created in admin, what you are actually doing is editing it...hence the .../edit/?id=1006. If you want something like .../admin/settings/ what you need is to create a process module or use some other modules available for PW. I am inclined to think, though (apologies if I am wrong) that you are a newbie to PHP as well? I am hesitant to point you to advanced stuff until you at least learn the basics of PW
- 21 replies
-
- admin
- admin theme
-
(and 1 more)
Tagged with:
-
"process to assign....": This tells me you are assigning your 'settings' page the 'wrong' template. Do not assign it the admin template. 1. First create your own template (no need for a template file; just the template). Call that template, say 'settings'. 2. Add the fields you want to that template. 3. Go to Admin (I mean the page Admin in the page tree), create a new page under the 'admin' page. Call it 'settings', give it the template 'settings'....you are good to go.. .... Pages under admin can only be seen by the 'supersuser' - so, no worries that people with the wrong permissions will see it . In addition, as I stated, these pages cannot be directly accessed via the frontend + your page will not have a template file....(not that it matters since this is an 'admin' page). Have you read up on the docs about how PW works? If not, you might want to do that first
- 21 replies
-
- 2
-
-
- admin
- admin theme
-
(and 1 more)
Tagged with:
-
Hi Madalin, Welcome to ProcessWire and the forums! There are a number of ways to achieve this. If it is only a settings page, then you can create the page as a direct child of Admin. I don't know what you mean by "to show as tab with some functionality" but the page should show up as a menu item in Admin. You will need to have a template for that page, of course. Add as many fields as you want to that template that will be used by your "settings" page. You can then pull up data from that page using the PW API, in this case you would want to use $pages since pages in Admin cannot be accessed directly in the frontend (so no $page). To output your settings fields...example.. echo $pages->get(12345)->title//Here, 12345 is the ID of your settings page. You can also retrieve the page by its path or title or name... Have a read here http://processwire.com/api/variables/pages/ http://processwire.com/api/variables/page/
- 21 replies
-
- 2
-
-
- admin
- admin theme
-
(and 1 more)
Tagged with:
-
Or if you are lazy like me... This should work as well, I think... $session->redirect($page->child()->url); In some cases, can be a good idea to first check if page actually has children ... if($page->numChildren) $session->redirect($page->child()->url) Oh, and welcome to PW! Edited: corrected code, etc...
- 5 replies
-
- 4
-
-
- mainmenu
- first child
-
(and 1 more)
Tagged with:
-
....nothing to see here, run along, ta ta...
-
Cool first post @carrdesigns! Welcome to the forums!
-
Updating a profile via the front-end. Code check?
kongondo replied to GuruMeditation's topic in Getting Started
Yes...use what is best for the job. $sanitizer->name is best for ProcessWire 'name' - Name is used to build the URL hence its formatting (of course you can use it if you require such formatting...) but in your case, text should be fine... -
Sorry, my bad. I misunderstood...Try this instead,, $p = $this->modules->get('ProcessPageList'); $p->set('id',2480); // the parent page return $p->execute();
-
$p = $this->modules->get('InputfieldPageListSelect'); $p->attr('name', 'products');//example name value for selected page //$p->set('parent_id', $parentId);//here we set the parent whose children will be selectable OR $p->set('parent_id', 12345);//here we set the parent whose children will be selectable $p->set('startLabel', $this->_('Product Blah Blah')); You can even change the 'more' and 'cancel' labels...
-
Hook to modify how repeater fields are rendered?
kongondo replied to Valery's topic in General Support
Nice to see this is coming along nicely Valery. Be warned though, Process Modules are addictive! -
Or you can use the search box on the cheatsheet page...
-
Thanks to Soma, we have this: http://cheatsheet.processwire.com/
-
echo $page->createdUser->name; Adrian beat me to it...OK, so am slow...nothing new there
-
I use Sublime mainly, but also use Np++ sometimes. PHP strings of HTML are highlighted just fine. Better if you concatenate variables within the strings (if any) rather than use curly braces..i.e. Rather than.... "My string is about {$page->title} and other stuff"; use this.. "My string is about" . $page->title . "and other stuff";
-
Hey Franko...welcome to ProcessWire and the forums! I don't know why, but I had a feeling you were coming in from MODx...been happening a lot lately...Anyway, enjoy!
-
Patiently waiting for Windows version .. ;-)
-
? U forgot to ask your question?
-
.....sometimes the API works just as well
-
Yes and Yes
-
A minor (but crucial) typo on second version; should be $wire->page
-
I'm jealous! Glad you guys had a nice time
-
Repeaters: sorting input fields; listing according to input fields
kongondo replied to joe_ma's topic in Getting Started
joe_ma. I like your tenacity! Sorry to see you are still struggling with this. Not a direct answer to your query, but I would like to suggest debugging your code 1 step at a time can help you find where the error is coming from; it is also fun and will make you a better coder in the long run. That's what I learnt from the gurus here ... You could do something like this: $events = $pages->find("template=repeater_time_loc, check_access=0"); //get all the repeaters with event information echo gettype($events) . '<br>';//this will tell you the type of variable you are dealing with [just an example] //if it is an object/array... echo '<pre>'; echo print_r($events);//verify $events is returning what you were expecting echo '</pre>'; exit;//stop other code executing Keep on doing this or similar line by line, Check even inside the foreach (e.g. print_r($days)) to verify things are being returned as expected, exiting after short lines of code, until the next variable, etc, etc.. Were you expecting an integer? Was a string returned instead? etc...This way, you will be able to (hopefully) identify where things are going wrong. Make sure debug is turned on as well.. Anyway, just thought to share my experience.... -
By crop image field, do you mean you are using the cropImage module? You can use a normal image field for your Avatars. You interact with that image field like any other image field..only this time you are dealing with the 'user' template. Also remember that in the DB 'users' are stored as 'pages' so, similar API syntax... See this post by Ryan: https://processwire.com/talk/topic/10-how-do-i-interact-with-the-image-field-in-processwire/ and the docs https://processwire.com/api/fieldtypes/images/ Btw, do you need a profile image to be that big?
-
Manaus, Not sure what your App does or its design, but I'm not getting why you need to store IDs (basically integers) using JSON? Can't these be stored as comma separated values? If you want to go the JSON route, there's various threads on the forums you can have a look at (Google )
- 1 reply
-
- 1
-