• Content Count

  • Joined

  • Last visited

Community Reputation

158 Excellent

About louisstephens

  • Rank
    Sr. Member

Profile Information

  • Gender
  • Location
    Greenville, SC

Recent Profile Visitors

2,386 profile views
  1. louisstephens

    Well look at that. It was simpler than I thought. Thanks adrian. I'll keep that one in my snippets.
  2. louisstephens

    Thanks everyone for the quick responses. Unfortunately when I do: $p2->parent = wire('pages')->get($parentPageName); I get the following: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in MAMP/htdocs/development/pw/wire/core/Selectors.php line 378) Im a little baffled as I thought it would work without the quotes as I dont see any glaring errors in Visual Studio Code.
  3. I am wondering, how do you pass a variable into wire('page')->get() inside a function? I have been looking through the forums, but unfortunately I have not found the answer yet. My current set up is: function generateNewPages($parentPageName) { $p = new Page(); $p->template = "parent"; $p->parent = wire('pages')->get('/home/'); $p->name = $parentPageName; $p->title = $parentPageName; $p->of(false); $p->save(); $p2 = new Page(); $p2->template = "child"; $p2->parent = wire('pages')->get('$parentPageName'); $p2->name = "child"; $p2->title = "Child Page"; $p2->of(false); $p2->save(); } When I try to run it by passing in a title like generateNewPages('Demo');, "Demo" is created, but when it gets to the child page I get: Unknown Selector operator: '$' -- was your selector value properly escaped? Is there a way to pass the $parentPageName to "wire('pages')->get('$parentPageName')" ?
  4. louisstephens

    Hey josua118, and welcome to the forums! Quick question for you, how are you rendering the field on the frontend?
  5. Hey @j00st, if you go and edit your original post, it will allow you to edit the title and prepend [SOLVED].
  6. louisstephens

    This currently is bug as ProcessPageEdit allows a super user to select any template. Abdus suggested a tweak that has worked for another user, and it can be found here:
  7. louisstephens

    Thanks @mke and everyone else for the help. I got the "content-type" in the headers to return as application/json now. It's odd to me that I can call response.headers and return all the header information for the call, but the data is just blank. I looked at the json on the the actual page and it is being returned as: [{"title":"Development","summary":"Epic cheeseburgers come in all kinds of manifestations, but we want them in and around our mouth no matter what. Slide those smashed patties with the gently caramelized meat fat between a toasted brioche bun and pass it over. You fall in love with the cheeseburger itself but the journey ain\u2019t half bad either.","body":" They\u2019re the childhood friend that knows your highest highs and lowest lows. They\u2019ve been with you through thick and thin and they\u2019re the best at keeping secrets. Whether it\u2019s dressed up or informal, cheeseburgers have your back.<\/p>\n\n Sometimes we lose sight of what really matters in life. There\u2019s something to be said for a gourmet brie and truffle burger paired with parmesan frites, but don\u2019t let that make you forget about the ol\u2019 faithful with American cheddar and a squishy bun. Lettuce remind you that cheeseburgers come in all forms - bun intended.<\/p>\n\n Pop quiz: what\u2019s the greatest thing to happen to your mind, body, and soul in recent history? A cheeseburger, obviously. Cheeseburgers know that what you want can also be what you need.<\/p>"}] (dont mind the placeholder text. Cheeseburger Ipsum.) I do have processwire in a subfolder, and my vue app is in a folder outside (just so I did not get to turned around). I also checked to make sure my api call began and ended with a slash as suggested but it doesnt seem to make a difference as of yet. My get response appears to be "200" coming from the vue app as well, so now I am just really baffled. ** Edit ** I did just find if I take my foreach statement: <?php $myPages = $pages->find('template=basic-page'); $data = $myPages->explode(['title', 'summary', 'body']); echo wireEncodeJSON($data); ?> and remove it outside of if ($config->ajax && $input->urlSegment1 == 'test-api') { } then the data attribute is properly filled out.
  8. louisstephens

    Thanks zeka, I was playing around with your suggestion, but if I look at the console, "data" is completely empty. I can out put the "json" by just encoding it, but it isnt passing anything actual to the app. Ill keep searching. { "data": "", "status": 200, "statusText": "OK", "headers": { "pragma": "no-cache", "content-type": "text/html; charset=utf-8", "cache-control": "no-store, no-cache, must-revalidate", "expires": "Thu, 19 Nov 1981 08:52:00 GMT" }, "config": { "transformRequest": {}, "transformResponse": {}, "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "headers": { "Accept": "application/json, text/plain, */*" }, "method": "get", "url": "http://1ocalhost:8888/development/sites/test/ajax-actions/test-api/" }, "request": {} }
  9. louisstephens

    Thanks dragan. In my head I just assumed that I would need to bootstrap it. I tried doing a simple ajax request like {{info}} is in the actual markup for the controller: import axios from 'axios'; export default { name: 'Api', data () { return { info: null } }, mounted () { axios .get('http://localhost:8888/development/sites/test/ajax-actions/test-api') .then(response => (this.info = response)) } } And in my processwire ajax-actions.php file: <?php else if ($config->ajax && $input->urlSegment1 == 'test-api') { $searchResults = $page->find("template=basic"); $json = array(); foreach($searchResults as $search){ $json[] = array( 'title' => $seach->title, ); } echo json_encode($json); } ?> I guess I have two issues with this setup. 1. In my console on my vue app, I get No 'Access-Control-Allow-Origin' header is present on the requested resource 2. And secondly, data that is output seems to be just " "{ "data": "", "status": 200, "statusText": "OK", "headers": { "pragma": "no-cache", "content-type": "text/html; charset=utf-8", "cache-control": "no-store, no-cache, must-revalidate", "expires": "Thu, 19 Nov 1981 08:52:00 GMT" }, "config": { "transformRequest": {}, "transformResponse": {}, "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "headers": { "Accept": "application/json, text/plain, */*" }, "method": "get", "url": "http://localhost:8888/development/sites/test/ajax-actions/test-api" }, "request": {} } What have I missed? Sorry, I am still trying to figure this all out.
  10. louisstephens

    So I have been diving into vue.js lately, and I am really impressed. I thought it could be perfect for an internal dashboard using PageQuerry boss to retrieve the data. However, I do have a few questions that someone might be able to guide me with before I fully commit. 1. Is it even possible to bootstrap pw into a vue app? 2. How would it be possible to handle user registration/logins without actually having to mirror the users on pw in another service? 3. I know I could easily use an iframe in a modal to handle page editing (as I have done it inside of pw before), but would this be the best solution?
  11. louisstephens

    I have used a lot of project management tools over the years, and I will say, I do like Monday. I built something (utilizing pw) based off the idea just as a test to my abilities. Unfortunately, I had something go wrong with the db so I had to get a fresh copy up and running. I made a page reference field (projects) for the user template and on the front end you could assign the user to the project (ajax call then selected the appropriate page in the user template). From there, the project page showed all tasks added to it with dates. Ill see if I can resurrect the app and take some screenshots.
  12. louisstephens

    Sorry @OLSA for the confusion. I was pretty frustrated and my question probably got garbled. Hopefully I can clear up what I am trying to do, as I switched gears a bit now that I have had time to think. The setup: 1. Repeater - dev_repeater - Image field (set to allow one) - dev_image 2. Nested Repeater - dev_button_repeater - Text Field - URL text to display on front-end - URL Field - dev_url - allows user to enter url (ie http://google.com), but if the item needs a data-attribute (for some ajax request), then they can use a hanna code [[data]] to add the attribute to the URL on the front end I guess what I am trying to do, in the hanna code, is get the image url so it can be present in the data attribute. Perhaps a nested repeater is not the way to go, but I didnt know of another way to allow the user to "add" multiple items all with different values.
  13. louisstephens

    Ill be honest, I am a bit unsure how accomplish this. I have a repeater (dev_repeater) that contains an image field set to 1 image. Nested within this repeater, is another repeater (dev_child_repeater) that allows a user to add in some urls. However, there is also a hidden field that I am trying to pass the parent repeater's image path. I know I can output all the data by using: <?php foreach($page->dev_repeater as $repeater) { foreach($repeater as $url) { # do some stuff } } ?> For the life of me, I can not figure out how to obtain the image url in my php to pass to a variable inside the nested foreach loop. Hopefully this made some sense.
  14. louisstephens

    Just curious, since you are using child pages as uikit elements, how does this effect actual child pages? For example, if you had "Services" built out with the "sections"/child pages, but then you have actual child pages of Services. Does this not get a bit messy?
  15. louisstephens

    Thanks elabx. I might need a bit more help here. I currently have [[print_image]]: onclick="printJS({printable: 'path_to_image', type: 'image'});" But I also need "path_to_image" filled out, but I wasnt sure how to echo the php inside of a hanna code that was set to "text/html". Perhaps I am making this more difficult than it needs to be, but I was trying to work around using if statements in my actual template to check whether the user typed a url vs the shortcode.