-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Let me search that for you Default language: Everything about displaying languages in frontend: http://processwire.com/api/multi-language-support/multi-language-fields/
-
I think I recognized that if a template has no php file it doesn't have the publish behavior. Not sure about others.
-
Ah that's something different. You could try something like this: 'item_tpl' => '<a href="{redirect_url|url}">{title}</a>' Then it will take the redirect_url if it's populated.
-
There's no way to do this in php, this has to be done in html or js client side. There's nothing against using target blank in HTML5. If you don't want to, you could add rel="ext" to the links and use jquery to make them behave like you want. This technique was often used in XHTML where target blank wasn't valid. Add it using javascript $("a[rel='ext']").attr("target","_blank"); Or using only the protocol, with any link that href starts with http:// $("a[href^='http://']").bind("click", function() { window.open( $(this).attr("href"), "_blank" ); });
-
TItle is needed for all pages. You can't change it to 'id' because it's a reserved word in PW. Why not just let it named title or add another field for?
-
Maybe because ProcessWire uses url already? $page->url
-
When I'm angry at Ryan I'm using this: javascript:var%20s%20=%20document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://erkie.github.com/asteroids.min.js';void(0);
-
jQ ui datepicker has languages http://jqueryui.com/demos/datepicker/localization.html It would be easy to just include the required [lang].js depending on admin language.
-
Show highlighted search keywords in search results?
Soma replied to MarcC's topic in General Support
I would pick js. Advantage would be that you can specify the context, to only highlight words in content for example, and you transfer the overhead to th client. Other than that it is personal preference. It would also be possible with a simple hook to page render and replace words in the output. -
Show highlighted search keywords in search results?
Soma replied to MarcC's topic in General Support
If you use jquery theres some easy way and do it client side. If you add ?q=searchword to the search result links it's easy possible. Some helpful links To get a url parameter http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery An lightweight plugin to highlight the word on page http://bartaz.github.com/sandbox.js/jquery.highlight.html -
You don't want to give access to the trash, it's a dark and dangerous stinky place.
-
What is $childSchild ? Don't think this even exists. How did you get to this?
-
Barry, using my MarkupSimpleNavigation module you could simply do: $nav = $modules->get("MarkupSimpleNavigation"); echo $nav->render(array( "max_levels" => 2, "show_root" => true, "current_class" => "on" )); Just in case. Edit: Ok the checkbox thing is not possible. But it would be possible using page "hidden" for page you don't want in mainnav. But your code is also nice and flexible if you need it.
-
sinnut is right, although it's using ksort and krsort. Don't know if there's a way around it. How about if you use the page name for sorting?
-
Cool, nice work. Glad you found ajax search module useful. Though I would add some float clearing in the content of the results, first entry get's floated because of the close button. Where is the ajax loader? It would help recognizing that it's searching.
-
I would choose ProcessWire. Sorry I'm too biased.
-
Your 2 examples are the same, so I don't understand what's going on on your side. BTW I recommend not using "$user" variable as it is a template variable which holds the current user so you overwrite it, but it should work anyway.
-
Thanks Dave for the report. Yes it returns the user. Well it's like this on http://processwire.c...iables/session/ that's from where the cheatsheet has its content originally. So it's wrong there already or Ryan changed it and forgot to change it in the docs. Anyway your code example both works... Not sure why it wouldn't work. If returned something else than null, false, 0 etc. it will be true even if it's a object... If conditions doesn't require to be "true" to work. if($loggeduser = $session->login($username, $pass)) { // if logged in succesful echo $loggeduser->name; } else { // failed }
-
Create new child as top sibling rather than bottom?
Soma replied to MarcC's topic in General Support
There is a way. // first get parent and it's first child $parent = $pages->get(1001); $first = $parent->child; // create new page with same sort as first child $p = new Page(); $p->template = $templates->get("basic-page"); $p->parent = $parent; $p->title = "Make me first"; $p->sort = $first->sort; $p->save(); // move first child to second position $first->sort++; $first->save(); Now your new page is at first position. However this only work if you got manual sorting on parent of course. -
Thanks sinnut for the report. It's not there because it's also not on API docs. But will gladly add it. I'm not sure why it's missing in the docs, is there any reason Ryan? Edit: well my guess is that is is not really reliable.
-
Absolute URLs / relative links to media, Embedded flash players
Soma replied to Chad's topic in General Support
I'm not sure I understand anything after "Example of what I'd like to happen:". I'm no sure what or even why you would want to "redirect" to another non PW page. But I don't see any problems referencing or linking media in your template files as you usually would in any website, PW only protects system files. If a file exists and isn't protected there should be no 404. Hard to really make any assumptions on how to best set it up or help without knowing or understanding your required project structure and needs in the full scope. -
I've "never" seen kB, looks wrong to me. Either KB or kb. Edit: Funny but looking at "dB", it looks right to me because I remember it from electronics and making music (amps etc)
-
It seems to be working good in my local install so far. Another question I wondered. How could I disable default language fallback when using in frontend? So I can output a field value as usual and it would return null if the current language field isn't populated, without setting outputformatting on an off. Edit: now trying even the suggested way to use of(false) and getLanguageValue doesn't work on language fields (image in this case) Error Exception: Method Pageimages::getLanguageValue does not exist or is not callable in this context (in /Applications/XAMPP/xamppfiles/htdocs/pw-dev/wire/core/Wire.php line 231) with this code $page->of(false); $lang = $languages->get("de"); $img = $page->image->getLanguageValue($lang); $page->of(true);
-
Now I'm very confused. Is this supposed to work like this for non and even text fields? How would I then use it, because in my case it wasn't working, the "header_image" wasn't returning anything? EDIT: Now it dawns on me, reading the docu again I remember reading something about it but forgot. Hmm will have to make another test, maybe something else went wrong, because the language was set to the default, yet nothing was returned for the image... even though other fields were working normal.
-
Inputfieldmodule doesn't autoload their js/css
Soma replied to apeisa's topic in Module/Plugin Development
Ah my colorpicker example isn't what I thought.. I decided to leave colorpicker js files in a subfolder as is. Sorry for the false example. But it really confused me in other modules I've done for sure. Just spoted something I didn't knew, thanks Ryan