alkahest
Members-
Posts
36 -
Joined
-
Last visited
About alkahest
- Birthday 10/25/1984
Profile Information
-
Gender
Male
Recent Profile Visitors
6,790 profile views
alkahest's Achievements
Jr. Member (3/6)
9
Reputation
-
Thanks Ryan! Ultimately I concluded the same: that I need to set $config->urls->root to /admin/ in any template that makes calls like these. That worked.
-
Ahhh, that does the trick! When I do $brand->meta_image->first->url, I get the filename as well. However it still outputs /5gum/ as the root: /5gum/site/assets/files/1033/slim_cobalt.png I know my setup is strange, basically there is a brand under each directory in the top-level domain: /5gum/ /some-other-brand/ /another-brand/ And they all share the same assets (images, markup, etc) from the /assets/ folder. By visiting /5gum/, the system pulls in all the includes it needs from /assets/includes/ like the footer.php and header.php and other files. However all PW is managing in this case is order information, so that's why it's bootstrapped in and cordoned off in its own folder under /admin/. I'm not using any template file output from PW, I just talk to PW via Ajax to send/retrieve order information (and some basic information about the products). What I suspect is that somehow PW thinks /5gum/ is the root of the site. In fact, when I ask for: $config->paths->root PW says the root is /5gum/ as opposed to /admin/. Is there a way to tell PW what the root of the site is? (And yes, if you go to mysite.com/5gum/ you hit index.php, which calls in header.php, which is where PW is bootstrapped.)
-
I'm having a weird situation where I'm trying to get the URL for an image attached to a page, but I'm getting back the wrong paths. The URL is mysite.com/5gum/. My file structure is like this: /admin/ <-- ProcessWire is in here -- /site/ -- /wire/ /5gum/ <-- my site templates are in here -- index.php (calls header.php below) /assets/ -- /includes/ ---- header.php I'm bootstrapping PW into header.php of a file under /5gum/. I'm trying to do something like this: $brand_slug = basename ($_SERVER['REQUEST_URI']); // this would get me "5gum" $brand = wire('pages')->get("name=".$brand_slug); // this gives me a specific page echo $brand->meta_image->url; // this should output the path to an image attached to the page If meta_image is a field that accepts a maximum of 1 image, shouldn't this return the full URL to the image? Instead, it returns: /5gum/site/assets/files/1027/ What doesn't make sense to me is that the root of the site isn't /5gum/, it should be /admin/ right, according to PW? Do I need to set the root somehow?
-
alkahest started following Where do I put functions specific to a profile? , Image paths when bootstrapping PW? , Does Processwire have an icon? and 1 other
-
I think I'm missing where they posted vectors - I definitely see the PNGs/GIFs tho!
-
Does PW have an official icon? Like some 16x16 dealio?
-
So, when I try: $state_set = $pages->find('template=state'); echo $state_set->getArray(); I get Array(); as the output. If I try: var_dump($state_set->getArray()); I get Proust.
-
Well, I have something as simple as a list of US states and their children (which are Schools). The US states just have a title, as do the Schools. I have looped through all the states and split them into two arrays for display purposes. All I want to do is var_dump the array that contains the objects, but PW spits out an insane 20 page novel about the contents of the states and their children.
-
Is there a way to do a var_dump() in PW without getting a massive incomprehensible array returned? The amount of data that's inside the object is so extensive that it often crashes the browser. Is there a wrapper function that's just for debugging?
-
How do make a selectbox fieldtype with static values?
alkahest replied to alkahest's topic in General Support
I don't think this approach would work in that situation, though, because in the case I was describing over there, I still want the client role to be able to add children in the admin, just not from the home tree. If the sectioned-off tree were under the admin, the client role wouldn't be able to access it, right? Or am I missing something? -
Where do I put functions specific to a profile?
alkahest replied to alkahest's topic in General Support
It sounds like this would be way more widely accessible than prepending a functions file before each template, I think I'll go this route. -
How do make a selectbox fieldtype with static values?
alkahest replied to alkahest's topic in General Support
Wow, I really like this approach. -
Where do I put functions specific to a profile?
alkahest replied to alkahest's topic in General Support
Sweet, I had no idea about that. I'll try that... Not sure what's going on either. -
This is pretty basic, possibly more PHP-related than PW: Where do we put generic functions that are specific to the installation? In WordPress, this was in the functions.php theme file, where if you put functions there, they become accessible throughout the application. I've made an init.php file that I include before the header/footer for all the templates in the /site/templates folder, but functions I define in there don't seem to be accessible to files included in those templates. (So like, page.php includes init.php, header.php, callout.php, and footer.php, but when I call someFunction() defined in init.php from callout.php, it tells me the function is undefined). I have a group of common functions I'm using across multiple sites defined in a module as static public functions of a single class, and that's working everywhere. Do I need to make a module for my functions specific to the installation?
-
How do make a selectbox fieldtype with static values?
alkahest replied to alkahest's topic in General Support
Yes, that makes sense. My only gripe has to do with presentation to the user in the admin; while right now I have the ability to slice off irrelevant/non-navigable parts of the main tree so that client user roles can't see it (like these colors in this case, which are not part of the hierarchy of the site in the client's mind), PW doesn't provide a built-in way to do that. From what I've read around the forum, there's no real hook to stop certain parts of the tree from rendering; I have to pop them out of the JSON per soma's technique. -
How do make a selectbox fieldtype with static values?
alkahest replied to alkahest's topic in General Support
PW continues to surprise me with its simple goodness.