-
Posts
273 -
Joined
-
Last visited
-
Days Won
2
Everything posted by virtualgadjo
-
Hi, two more litte cents ? if this hosts var is not well filled you may also run into another little problem as pw automatically build the preview links in the admin based on this var have a nice day
-
Hi @marie.mdna if i'm not wrong this depends on your config file $config->httpHosts var, if the first host in the array contains the www, the sitemap will use it too (at least, that's what happens for all the websites, a lot..., for which i've this module installed ? have a nice day
-
hi @elabx you're completely right, and following you on the elaboration path, my savage little script is just the php way of doing what @mel47 was trying to write with any kind of array and number of columns but, honestly, nowaday, if i had to do this, as much as i love php i would probably simply iterate the array in the template inside one div/container and use css to generate the columns... ? have a nice day
-
Hi, i think this is more a php question than a pw one, then i'll answer in my savage php way ? let's assume $intruments is an array and you don't know how many intruments there are, you don't need those first, second col and so on, just iterate $isntruments $total = count($instruments); $colmax = ceil($total / 3); $i = 1; $out = '<div class="column">' . "\n"; // or .= if $out is initialised above foreach ($instruments as $inst) { $out .= '<p>' . $inst . "</p>\n"; if ( $i == $total ) { $out .= "</div>\n"; } elseif ($i < $total && $i % $colmax == 0) { $out .= "</div>\n"; $out .= '<div class="column">' . "\n"; } $i++; } echo $out; // or return if in a function should do the trick, no matter $instruments contains 15, 17 or 200... instruments ? have a nice day
-
How to redirect the user back to desired URL after login page?
virtualgadjo replied to tires's topic in General Support
hi, the pw way on top of a page $input->urlSegment1 you can use various functions to check if there is one or no, for example if ( strlen($input->urlSegment1)) $foo = ... and of course validate if the segment is an authorized one, regex for example, beginning with the segment you accept in the model parameters (i nearly always use regex, i.e regex:^[0-9]{1,5}$ //or 6,7... depending on how many pages you'll have :) that will check the segment looks like a page id, if not, 404... now, coming to hooks, never did this, il let @Robin S answer this, he knows pw and hooks far better than i do ? have a nice day -
How to redirect the user back to desired URL after login page?
virtualgadjo replied to tires's topic in General Support
Hi, @Robin S is right, my url segment idea is not necessary but just a simple way to keep the page id alive ? now, honestly, when i have to do what you described, as much as i love coding, hooks and all what pw gives us i would probably use session vars the way @Robin S shows in the hook but simply in the login page code, maybe because i'm too used to doing this kind of thing without the help of pw... - if the user arrives unlogged on the page, i would set a session var with the id of the page and then redirect to the login page (instead of login/pageid that doesn't need this session var) - if the login is successful, simply use pw redirection abilitiy to the page the id is in the session destroying the var that isn't useful anymore but using the login/register plugin @Robin S's hook is more the pw way of working than my savage 'manage your life on your own' solution ? have a nice day -
@bernhard yeah, i love the page with all the needed snippets! exactly what i have done for a client who needed many carrousels they could use on several pages where they want a parent page with children, each one containing a carrousel and hannacode to use those any where in content fields @Robin S HannaCodeDialog could also help in this case that's what i love with pw, with a little imagination, it lets you do whatever you want in an incredible easy way for the customers to edit ? have a nice day
-
How to redirect the user back to desired URL after login page?
virtualgadjo replied to tires's topic in General Support
Hi @Robin S let's imagine this https://foo.com/userlogin/3025 isn't it easy to grab 3025 and, if the login is successful, redirect the user to $pages->get(3025)->url;? would be the same with a page name and easy to change each time the page you need to redirect to does just a simple question ? have a nice day -
How to redirect the user back to desired URL after login page?
virtualgadjo replied to tires's topic in General Support
Hi, just my two cents ? for a front-end login page, url segments could be your friends (the page to be redirected id, name or whatever you want) a little regex to keep them safe, it wouldn't change the login url and you could grab it like a var, same thing as what @bernhard has highlighted for the pw native login have a nice day -
hi, wow, thansk a lot @bernhard i didn't know this module and it looks fantastic i think that it's not exactly what @DansDomain was looking for because the full field is managed by the syntax higlighting you choose instead of being able to post a snippet inside a long piece of "normal" content but it gives me an idea, using ACE for a field, CKEditor for the text content and hannacode to insert the full code field into the CKEditor one, even two or three little snippets and hannacode with the name of the fields as a variable well, sure when you have a lot of little snippets it's probably easier to use the codesnippet plugin and apply classes to the code tags to have them stylized on the front end but i can imagine cases where this ACE/hannacode solution would be very useful thanks again and have a nice day ?
-
hi again, as i love these little kind of challenges ? found out something as i said, just add a config.js file inside the module folder (not the plugins one, just site/modules/InputfieldCKEditor/) with this CKEDITOR.editorConfig = function( config ) { config.tabSpaces = 4; }; and your tab key will add four in a row which you'll not be loosing on the front side have a nice day ?
-
oh, sorry, forgot to speak about highlight.js, honestly this is more a styling librairy you'll use for the front end... but you can also add a config.js file in the module folder to overwrite some default ones or add some functionnalities (sometimes useful event for some plugins) with CKEDITOR.editorConfig = function( config ) { // your js // could be as simple as config.extraPlugins = 'codetag'; // but you can add more :) }; but i would not abuse of this possibility not to complicate things in the admin ?
-
hi, well, as i said, that's where you'll have to try... for example, try CodeSnippet or Codesnippet between commas if inside a line or just after a comma if at the end of a line, save and have a look at a page using the field by default, pw only lists the... by default available buttons but you can add as much as you need ? have a nice day again ?
-
Hi, juste for those two plugins, you'll find the links here https://ckeditor.com/docs/ckeditor4/latest/examples/codesnippet.html just pay attention when you download a plugin, quite often there are dependencies you'll have to download and install too installing a plugin is often as easy as putting the folder into the pw site/modules/InputfieldCKEditor/plugins folder that pw creates the first time you choose CK editor as your textarea field type afterwards, in you CKE field config you'll see the list of plugins that are in this folder, check the ones you need when a simple functionnality like nbsp for example, nothing else to do, when the plugin allows you to add a button to the toolbar, will be your case, just add its name in the toolbar list of buttons the pw way where you want it to be you'll probably have to test where to use uppercases but honestly, it works like a breeze too ? have a nice day and CKEditor trip ?
-
what @Jan Romero says ? and i would just add, if your code snippets are parts of a larger ckeditor content type, you could just add their code snippet plugin and, if you want it to be stylized the dev fashion way, add the code snippet geshin plugin too ? ckeditor is easy to customize and has a bunch of plugins you can use depending on what you need have a nice day
-
Hi, hard to answer without knowing which formatter you're speaking about and in which type of field what i can just say about the code snippet you've posted is, in a template code it would easy to indent with \t echo "\t\t" . 'This site has a Code button...' . "\n"; echo "\t\t" . 'That's precisely what I need in my editor...' . "\n"; echo "\t\t" . 'Where do I get it?' . "\n"; would indent each line with two tabs and \n will create a new line, your three echo will end in a single line but i guess that's not the actual code you're writing... ? have a nice day
-
Get value in other language (not default) if field value is empty
virtualgadjo replied to nabo's topic in General Support
that's why what i suggested is to - grab the default language value - then grab the current language value - comparing them both, if the current one is the same as the default one, the value for this language is empty as if it weren't both values would be different ? if they are identical, up to you to do what you want ? and pw is so fast, this shouldn't be too consuming have a nice day -
Get value in other language (not default) if field value is empty
virtualgadjo replied to nabo's topic in General Support
Hi, too bad, if you can't change it because it's used in other circumstances for the given field, the simplest way i can imagine is, when you need a different behaviour, in your template, just check if the value for a given language is the same as the default language one and, if so, just grab the value from another language, a bit savage but it should work ? have a nice day -
Get value in other language (not default) if field value is empty
virtualgadjo replied to nabo's topic in General Support
Hi, have you tried checking the "remain blank" option for the fields you want to work this way as, by default, it's the "inherit value from default language" that is checked? have a nice day -
Hi, running quite often ibto that kind of situation i now use a solution that seems a little like @DaveP's one let say you need a gb img or the large image on top of each page i always create a default fields "page" with a no-file template (hidden page of course) then i create the bg_img image field that will be used in every template, including the default fields one and, for this field i use the default value feature provided by pw, guess, the default value is in... the default fields page ? this way, no need to fill this field for every page but if you need a specific image for some pages (something that happens quite often in real life ? ), easy peasy, just fill the field in those pages in case it may help have a nice day
-
Hi Vincent, sorry to be a bit long to answer... as soon as i can get some time to have a try at this pull request thing, i'll do it (currently working on a complicated website, with pw of course :)) the thing is i like to test things before making big mistakes that don't only impact... me and as much as i like playing with git, having always been working alone, i have never used those collaborative functions except for, looong ago, with the old svn ? in the meantime, don't hesitate to do exactly what you want with my repos, they are here to be useful without any need for me to be tagged, quoted and so on ? Have a nice day
-
thanks again @Robin S this could make me try to the module in a repeater as it uses ajax loading a lot even if it uses "transparent" pages too ? will i resist to try? it's such a client helper when editing their website ? have a nice day
-
Hi @Robin S and again, thanks so much for your answer, it works!! and, not only does it work but it helps me understand even deeper how pw back office works i went for the first solution if(!$input->is('post')) { // works fine too :) as it may help for other kinds of fields that need formatting to be used in the back office the same way as on the front end like, in my case, @kixe's FiedtypeColor to get the formatted output # included again, thank you very much for your time and insight have a nice day