-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
160
Everything posted by kongondo
-
Auto populate address field for Leaflet Map
kongondo replied to swampmusic's topic in General Support
Hi @swampmusic, I see that you've already asked the same question here : As per the rules, multi-threading is not permitted . I note you haven't received an answer yet in the other post. However, I'd ask for a bit more patience on your part. I'll lock this thread and will attempt to answer the question in your original post.- 1 reply
-
- 1
-
-
- autopopulate
- address field
-
(and 1 more)
Tagged with:
-
This, partly, looks like a job for Profields Table? However, this... ...seems like you need the dynamism to be created during page edit.
-
There's this one...which you contributed to ....
-
Welcome to the forums @fira. A bit difficult to answer your question without get the full information. Strictly speaking, this is a JavaScript question. Before getting into whether you should use 2 ajax calls or not, IMHO, it is more important to ask whether, in the first place, you need to use ajax at all? I am not questioning your abilities; just wondering if you haven't considered that question, then it may be important to do so. If you will be running a high traffic site, your server can easily be brought to its knees with ajax hits. Some ways to mitigate that include caching your data, if possible, both client- and server-side. That way, data is sent only once. Of course, this depends on your implementation. In your particular case, the key question is what is $sortvar? If you will be getting the same children, only sorted differently, then you might want to consider doing that client-side. OK, back to your main question about using 2 ajax calls. If you take that route, the above considerations apply. Alternatively, if possible, load everything that is needed beforehand into a cache or hidden element, then use jQuery or similar to show [aka load] the links you want on demand in the different containers. A final thing, using $page->children() without a limit is not recommended unless you will only ever be dealing with a handful of pages (maybe 50 - 100). Hope this helps .
-
Switch Statement to control included files
kongondo replied to louisstephens's topic in API & Templates
If the only place you use headerSwap() is in your home template file, then you could just use your code directly. No real need to use the function. There are other ways to go about this, btw. -
Switch Statement to control included files
kongondo replied to louisstephens's topic in API & Templates
Brilliant! Keeping up with the theme of learning....I can't stress enough the importance of debugging and testing your code. We have 2 great utilities in ProcessWire (besides PHP itself) to help us with these, namely $config->debug = true and Tracy Debugger. If you were testing with Tracy, she would have shown you where the error was, to be precise, these 2 PHP notices. Undefined variable config Trying to get property of non-object in... Why is this happening? Remember, you are including your *.inc files within the context of a function headerSwap(). Regarding the first notice, this takes us back to what I stated earlier; headerSwap() does not know what $config is. That variable is out of scope. In respect of the second notice, you are then saying give me the properties 'urls' and 'templates' of this variable $config. That will obviously fail, since notice 1# has already told us headerSwap() does not know what $config is. The solution, is as before. In fact, the hint was in your statement: ProcessWire 'cant' access. So, we give it access. As simple as this in your *.inc files: <?php echo wire('config')->urls->templates?>/main.css ?> Now you can call your function (see the suggested code in my edited post above): headerSwap($page->url); -
Switch Statement to control included files
kongondo replied to louisstephens's topic in API & Templates
I doubt that's necessary in this case. He wants the current URL. @louisstephens, if all you want is the URL, then this should do it.. $homepage = wire('page')->url; Edit...but maybe easier just to pass the URL to the headerSwap() as a parameter like this: // Include New Header function headerSwap($url){ switch($url){ case "/page-link-one/"; include('headerone.inc'); break; case "/page-link-two/"; include('headertwo.inc'); break; default: include('default.inc'); } } You would then call the function like this: headerSwap($page->url); -
Switch Statement to control included files
kongondo replied to louisstephens's topic in API & Templates
$config->httpHost; This does not return a URL. It returns the Current HTTP host name. E.g. processwire.com, hence doesn't match your cases. Edit: In addition, since you are in a function, your headerSwap() function does not know what $config is. You will need wire('config'). -
Or...if those items within each list are some child pages or some items in page fields (those are the usual approaches), all you need to do is to generate them in your template file. For instance, if you had the following site structure: Home Categories Tanks and Spaghettis T-Shirts and Polo T-Shirts Brands Apple ASUS Mobile Phones Mobile Phones Android Phones Foot wears Sports Shoes Casual Shoes Books Literature and Fiction Competitive Exams In template, you would do something like this. $items = $pages->find('some-parent-template');// this is the template for Categories, Brands, etc... foreach($items as $item) { // some code here...to build Column Headers foreach($item->children as $child) { // code here to build list } }
-
Maybe if you explained exactly what you would like to achieve? Creating fields only to store unordered lists might be an overkill. Welcome to the forums btw..
-
I think you got the wrong forum @alinamikecake. This is the ProcessWire forum. I see nothing regarding ProcessWire in your post, unless I am mistaken.
-
You could truncate the tables using phpMyAdmin or similar. See this, for instance:
-
I can only guess what's going on at this point. I suspect the upgrade didn't go smoothly. Are you able to downgrade and try again? Also, anything relevant in this thread?
-
Strange. You say you copied the complete page to your local computer....etc. If you could also clarify: AMP versions: PHP, etc... Is this happening on all pages regardless of the templates they use? What about editing existing pages; are their values saved OK? Did you have Tracy Debugger installed? If not, could you install it and see if it catches any errors? Is there some Hook(s) running on page save?
-
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
Excellent! Glad you got it working. Edit: If you can mark this as solved then, by editing the title of this thread to [Solved]....rest of title... -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
Is this it? http://stackoverflow.com/questions/19073270/stop-caching-for-php-5-5-3-in-mamp OPcache is enabled by default is some version of MAMP. -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
Everything works as expected here. Changes made in the template file are reflected immediately when I reload the browser, whether I am logged in or not. I have tested in PW 3.0.42. Maybe some MAMP thing? -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
I get you now. You are making changes in the template file and those are not being reflected in the frontend unless the cache is cleared, right? Let me test that. -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
I am a bit confused. Isn't that the expected behaviour? You change a value, you save, then you see the new value? Please also see my edit in the post above yours. -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
Is this happening for all pages (i.e. for different templates) and all fields (i.e. title versus body fields, etc)? Edit: Just notice you said you are using $p->render()? Can you show us some code? -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
I see. I am not seeing that at all in my tests. Looks like a Markup or Field or most likely Template cache. Are you sure you did not accidentally enable cache for the template that page uses? See Cache Tab when editing the said template. -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
When it comes to styles, my bet's on browser cache. If you want Chrome to fetch assets from the server, leave the dev console open as you develop, or develop in an incognito tab. From what I know, ProcessWire does not cache anything in the frontend unless you implemented that yourself, e.g. MarkupCache, etc. -
solved is page render cache always enabled?
kongondo replied to sakkoulas's topic in General Support
You are sure that's not your browser cache? -
That's strange. Maybe let's start by refreshing the cache several times...sometimes doing it once doesn't cut it. This includes refreshing/deleting the ProcessWire 3.x compiled files; it will rebuild them if you delete them. What modules do you have installed? You also need to re-enable JS. That's required in the admin. No console errors you said?
-
Haven't read or understood your whole post but if $input->whitelist->st is an array, and $st->name I guess is a string, in PHP, you cannot compare an array to a string like that.
- 21 replies