-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
Mod Note: Moved your topic here as it is not a ProcessWire question but a general dev one.
- 5 replies
-
- 1
-
- attachment
- fixed
-
(and 1 more)
Tagged with:
-
I am not sure I follow either but I'll have a go . Is $page->alias a string or an integer? I am curious since you do this: author.id=$page->alias. Did you create your own field called id or is that the inbuilt page ID? I don't understand the foreach question. If what you are after is matching multiple values or multiple fields, then what we use are pipes |. See this docs. You say you would like to match publications by either name or their alias. However, the examples you give are not using or selectors; they are using AND selectors (i.e. comma separated selectors). See those docs for the differences.
-
Hmm...I don't think it's possible. But you never know!
-
True, but not sure Ryan is monitoring issues in the old repo .
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
Just a quick by the way, I recently updated the first post in this thread to state that the wireRenderFile() approach is the recommended way to use this module. I'll update the README too when I get the time. -
Maybe we should file it as a bug...(which it is, since it has been implemented since 2.5.22 but it's not working), rather than a request?
-
Excellent! Have upvoted the new one. We will also need to update the Docs. The selectors docs says it doesn't work; the blog post says it does .
-
Do those variations have to be searchable? E.g. Should users be able to search for, say, a Purple shirt, of size M and material Cotton? If yes, then we could be talking a DB table for each variation with foreign keys to link the products. If not, then you might just about get away with storing everything in one column of a table using, say, a JSON string.
-
You are right, Benjamin. If one changes the selector to match only 1 parent like shown below, the two finds become equivalents. // these two are equivalents $items = $pages->find("template=minimal, has_parent={$page}, limit=10"); $items = $pages->find("has_parent={$page}, template=minimal, limit=10"); Do you know if a bug report has been filed about this?
-
Actually @LostKobrakai, it does as of ProcessWire 2.5.22? No? https://processwire.com/blog/posts/processwire-core-and-profields-updates-2.5.22/#has_parent-selectors-now-support-multi-value
-
FWIW, here are the resultant queries (similar, not identical to yours) for the two finds: Find 1: $categories = $page->children("template=blog")->add($page); $selector = "template=blog-post, has_parent={$categories}, limit=7"; $query = wire('pages')->getPageFinder()->find(new Selectors($selector), array('returnQuery' => true))->getQuery(); echo $query; Resultant Query: SELECT SQL_CALC_FOUND_ROWS pages.id,pages.parent_id,pages.templates_id FROM `pages` WHERE (pages.templates_id=77) AND pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=3545 OR pages_id=3545) OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=3560 OR pages_id=3560) OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=3565 OR pages_id=3565) OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=1044 OR pages_id=1044) AND (pages.status<1024) GROUP BY pages.id LIMIT 0,7 Find 2: $categories = $page->children("template=blog")->add($page); $selector = "has_parent={$categories}, template=blog-post, limit=7"; $query = wire('pages')->getPageFinder()->find(new Selectors($selector), array('returnQuery' => true))->getQuery(); echo $query; Resultant Query: SELECT SQL_CALC_FOUND_ROWS pages.id,pages.parent_id,pages.templates_id FROM `pages` WHERE pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=3545 OR pages_id=3545) OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=3560 OR pages_id=3560) OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=3565 OR pages_id=3565) OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=1044 OR pages_id=1044) AND (pages.templates_id=77) AND (pages.status<1024) GROUP BY pages.id LIMIT 0,7 I am guessing (am no SQL guru) the key thing is that we are dealing with an AND selector, maybe? Edit: Me thinks this is a bug in the selector engine itself?
-
Move RepeaterMatrix data to another RepeaterMatrix within a Repeater
kongondo replied to a-ok's topic in General Support
Maybe this Admin Actions by @adrian, as a starting point? https://processwire.com/talk/topic/14921-admin-actions/?do=findComment&comment=137919 Edit: And this too, earlier today https://processwire.com/talk/topic/15449-how-to-add-repeater-items-to-repeater-inside-repeater-matrix/ -
It has to be an array, yes. According to that warning, it says nothing (not empty, but nothing) is being returned by $input->get->cb_sectors. Do you have a typo somewhere? Maybe if we saw the whole code we could better help.
- 21 replies
-
- 1
-
Which part is not working? Is $selected not getting applied or it is being applied multiple times (even when it shouldn't)?
- 21 replies
-
Wondered about that but too but it seems there could be upwards of 3 variations, e.g. colour, size, fabric as well as price.
-
That, actually, has nothing to do with MSN (from what I can tell). It's called CSS ....the styles are cascading. You need to solve this in your CSS file.
-
@rolisx, Mod Note: Please use code blocks around code in your posts (see the <> icon).
-
I see at least three options: An auto-load module (might be an overkill though) that will copy the title to the address JavaScript via a module like RuntimeMarkup, which you could then hide from being visible on the page. Or even better, the module AdminCustomFiles Copying and modifying the Leaflet module itself to suit this need So yes, it is possible .
-
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);