Jump to content

gebeer

Members
  • Posts

    1,554
  • Joined

  • Last visited

  • Days Won

    48

Everything posted by gebeer

  1. Hi all, I'm working on a function that outputs markup for a bootstrap 3 carousel. I'm passing the $page->images object to the function argument $images. To have an individual id for each carousel on a page with multiple carousels, I want to use the image field id and the page id of the page were the image field sits. I can get the image field id with: $images->field->id But I can't seem to get the page id although it's there in the var_dump of the $images object: object(Pageimages)[203] protected 'page' => object(Page)[206] protected 'template' => ... protected 'settings' => array (size=10) 'id' => int 1013 //this is the id I need ... protected 'field' => object(Field)[72] protected 'settings' => array (size=5) 'id' => int 100 //this one I can get with $images->field->id ... When I try $images->page->settings->id I get null. When I try $images->page->id I get 1012 instead of 1013. 1012 is nowhere to be found in the $images object. It is the id of the page from which I'm calling my function. But I'm not passing the $page object to my function. So where does it come from and how can I get the correct page id? Thanks for reading through this!
  2. Thank you for clarifying.
  3. For my case this seems not to be the case. Or it doesn't apply to the children of the page you get. I tried this code to retrieve children, including hidden ones, but it doesn't work. It only gets non-hidden children. foreach ($pages->get($page->id)->children as $child) : Before I had foreach ($page->children as $child) : which does not get the hidden children, either. Only this gets hidden children for me: foreach ($page->children('include=hidden') as $child) :
  4. I just start explorin different templating approaches. Ryan's main.php method appealed to me so I converted my template structure from the good old head.inc, foot.inc to the main.php structure. Everything is working fine. Just one thing I cannot get my head around: I have basic-page.php: <? // Template basic-page if($page->numChildren) { foreach ($page->children as $child) { $page->outMain .= $child->render(); // list the children } } include("./main.php"); ?> This renders all children, all of which have basic-sub-page.php as template: <article class="article row"> <h1 class="col-md-12"><?= $page->title?></h1> <figure class="figure col-md-4"> <?= $images; ?> </figure> <div class="text col-md-8"> <?= $page->body; ?> </div> </article> <? include("./main.php"); ?> $images is irrelevant for my question, it just outputs img code. You see that I include main.php also in the basic-sub-page.php. This is fine when I call the page directly. But when calling it through $child->render() in basic-page.php, then I don't want to include main.php. How can I conditionally include main.php depending on whether the page gets rendered directly or through $child->render() ? Any ideas would be much appreciated.
  5. The image name gets changed because PW makes a cached version of your image that gets the dimensions appended to the name. Why is the different name of the thumb image a problem? Do you want to use it on the page as a caption? Is the PW version of the example image a resized output, like bathroom.1000.0.jpg? This is because you are using $photo->size(1000,$options) As adrian said, with size() you will have to use width and height (sorry for giving you wrong example code above). If you change this to $photo->width(1000,$options) and your options array to $options = array( 'quality' => 100, 'upscaling' => false ); Then you get the desired effect. Please have a read through: https://processwire.com/api/fieldtypes/images/ It's all in there. It can't be responsible because it's code is not executed if you don't call the photoSwipe plugin in your template. You most likely get a JS error in your console.
  6. OK, so in Craigs photos.php and photos_index.php add this at the top: <?php include("./head.inc"); $options = array( 'quality' => 100 ); ?> And change every instance of $photo->size(1024)... $photo->size(260,260)... to $photo->size(1024,$options)... $photo->size(260,260,$options)... This ensures that the thumbnails are generated in the best quality possible. If the resulting quality is not good enough (you said you were picky about that) you still have the option to generate the thumbs through Photoshop and include a separate thumb-images field into your page template where you upload them. You only would have to make sure then, that both thumbnails and images are in the same order. Maybe you can attach a screenshot of the resulting page or, even better, one of the generated thumbnails on that page so we can see what you mean by "blurry".
  7. Hi Max, can you provide us with a link to the page or source code of the page, including css? The images might be blurry because their actual proportions don't match the displayed proportions. By default, PW doesn't change anything about the uploaded images if you do not tell it to do so. In your images field setup in the backend, do you have any dimension restrictions there? You can adjust the quality of your thumbnails with an options array that you pass on to the resize function: $x = 100; $options = array( 'quality' => 100,// adjust quality here 'upscaling' => false, ); $thumb = $image->width($x, $options); For more info see here. For fast page loading I suggest using a jQuery lazy load plugin.
  8. frankensteining - hahaha - hope you won't need too much power to bring it to live ;-) It took me a while, too, to get my head around the setup. What helped me to finally find the right setup was the section "Working with Existing projects" in the Foundation 3 docs here.
  9. gebeer

    Vagrant

    I'm using vagrant on a Linux box and am quite happy. Only drawback is that file operations on the nfs mounted directory where my sites live are slow sometimes, especially when extracting archives through php. Other than that I love it because I work on different boxes and have the same dev environment. I stumbled across a vagrant box that has PW preinstalled but haven't used it yet.
  10. Hi Russel, you can also take a look at the directory structure of my Foundation 5 profile at github. I have the config.rb inside the scss and adjusted the paths accordingly. You could basically put your scss stuff and config.rb anywhere as long as you have the right paths defined in the config.rb.
  11. Hi there, today I was playing around with Bootstrap 3.1 and PW. I downloaded a boilerplate template for Bootstrap3.1 from initializr. Then I took a virgin PW 2.4 install and merged the initializr files with the files in PW template folder. I didn't touch any of the content and tried to replicate the site-default template as close as possible with Bootstrap markup. Only thing I added is a carousel instead of the random image. The result is a default PW install with Bootstrap look. For the main menu, I took Damienov's rendering function from here. To install my template: 1. Do a default PW 2.4 install 2. Unzip the attached file 3. Replace the original site/templates folder with the one from the attached zip file. The result can be seen here: http://pwboot.webseiten-fuer-alle.de/ templates.zip
  12. At first glance I thought this to be a great idea. But thinking about it twice brings up a major question for me: What profiles do you want to offer on first install? Suggestions here were: What about Foundation5 profile or Bootstrap profile or...? It all depends on personal choice which profile/framework to use. Many of us are building there own starter profiles. So in order to satisfy most people's needs, there would have to be at least 5 different profiles to choose from which would blow up PW initial install files size considerably. As Pete said it should not be too difficult to copy some extra files over the original ones before installing PW. Finally, the great thing about PW is that it doesn't make any assumptions about how you want to code your template. And I think it should stay that way.
  13. @bwakad my template is also on github: https://github.com/gebeer/pwfoundation5 You find instructions for installing and also for update of Foundation on github in the Readme.md.
  14. @Joss, sorry for having remembered this wrong. It's been a while since I was looking at your template in detail.
  15. My template is supposed to look identical with Ryan's. I took a copy of his template and amended some code to make it work with Foundation 5. The main difference to Ryan's Foundation 4 template is that mine uses compass/scss while Ryan's template uses the default Foundation 4 style.css. Compass/scss makes styles easier to adapt. And all the styles are being compiled into one css file. I put this together mainly to learn more about Foundation and compass/scss myself Joss's demo looks different because he changed the styling in the css file along with some other stuff. His template doesn't use scss and compass (as far as I'm aware).
  16. @adrian thanks for the suggestion. My string is coming from a TinyMCE textarea field, so it already has the required <br> and <p> tags. And I don't need to preserve the line breaks in my source code.
  17. Hello all, The map display used to work on my site, but now it is broken. You can see it here. In Firebug I get: SyntaxError: unterminated string literal. In my template I'm calling the map like this: $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, 'map', array('markerTitleField' => 'fulltext', 'height' => '400px', 'useHoverBox' => false, 'useMarkerSettings' => true, 'markerLinkField' => '')); Looks like the string that comes from fulltext field causes the problem. This is a TinyMCE textarea field. The rendered code looks like this: <script type='text/javascript' src='/site/modules/FieldtypeMapMarker/MarkupGoogleMap.js'></script><div id='mgmap1' class='MarkupGoogleMap' style='width: 100%; height: 400px;'></div><script type='text/javascript'>if(typeof google === 'undefined' || typeof google.maps === 'undefined') { alert('MarkupGoogleMap Error: Please add the maps.googleapis.com script in your document head.'); } else { var mgmap1 = new MarkupGoogleMap(); mgmap1.setOption('zoom', 12); mgmap1.setOption('mapTypeId', google.maps.MapTypeId.ROADMAP); mgmap1.init('mgmap1', 49.926418, 10.875330); mgmap1.addMarker(49.926418, 10.875330, '', '<p><strong>Zahnarztpraxis</strong><br /> <strong>Dr. med. Gabriele Wunschik</strong></p> <p>Bamberger Straße 33<br /> 96103 Hallstadt</p> <p>T: 0951/71 797<br /> F: 0951/97 10 438</p> <p><a href="GOSPAM:ed.kihcsnuw-sixarptzranhaz@ofni"><span style="unicode-bidi:bidi-override; direction: rtl;" class="email-obfuscator-unreverse">ed.kihcsnuw-sixarptzranhaz@ofni</span></a></p>', ''); }</script> The line breaks in the string seem to cause the problem. Javascript strings can't break across newlines without an escape (\)? I have added this code to MarkupGoogleMap.js so I can display an Info Bubble: var infoBubbleContent = '<div class="infoBubble">' + title + '<br><a href="https://maps.google.com/maps?hq=dr.+gabriele+wunschik+zahnarzt+hallstadt&daddr=Bamberger+Stra%C3%9Fe+33,+96103+Hallstadt,+Germany&panel=1&f=d&fb=1&geocode=0,49.926427,10.875077&cid=17504796733665686542" target="_blank">Routenplaner<\/a>' + '</div>'; var infoBubble = new InfoBubble({ minWidth: 250, minHeight: 250, map: this.map, content: infoBubbleContent, position: latLng, shadowStyle: 1, padding: 10, backgroundColor: 'rgb(255,255,255)', borderRadius: 4, arrowSize: 50, borderWidth: 1, borderColor: '#cccccc', disableAutoPan: true, hideCloseButton: false, arrowPosition: 30, backgroundClassName: 'phoney', arrowStyle: 2 }); infoBubble.open(this.map, marker); google.maps.event.addListener(marker, 'click', function(e) { infoBubble.open(this.map, marker); }); How can I add the escape character to or remove the line breaks from the string in "title" variable in MarkupGoogleMap.js? Any help would be much appreciated. Gerhard EDIT: OK, got it. I first tried this in MarkupGoogleMap.js: var infoBubbleContent = '<div class="infoBubble">' + title.replace(/\r?\n|\r/g,"") +...' + '</div>'; Wouldn't work. Then I changed original line 204 in MarkupGoogleMap.module from $title = $options['markerTitleField'] ? $page->get($options['markerTitleField']) : ''; to $title = $options['markerTitleField'] ? preg_replace( "/\r|\n/", "", $page->get($options['markerTitleField']) ) : ''; This did it. Is there any PW API method that I could use instead, like wire('sanitizer')?
  18. Thank you Ryan, for the explanation. My multilingual project is running smoothly. I made the default language German because this is the main language of the site. So no need to change the guest user language. For me this seems the most logical way to setup multiple languages.
  19. @SiNNuT thank you for the links. With my limited knowledge of the subject I wasn't aware of the facts mentioned there. Very interesting, indeed and good points for discussion with my clients.
  20. @Ryan most of my clients require to have sites W3C validated and it is considered good practice anyways. Thus it is essential to have the title attribute in <a> tags. Would you perhaps consider to make this standard for PW's link dialogue with TinyMCE (and CKEditor)? I couldn't find instances of "pwlink" in the TinyMCE settings on both, 2.3 and 2.4 installs. When I switch to CKEditor, there are references "PWLink" in CKEditor Toolbar settings and "pwlink" in Extra Plugins. When I change PWLink to "Link" and remove the extra plugin pwlink, I get the standard CKEditor Link dialogue where I can enter a title attribute in the Advanced tab. Cheers Gerhard
  21. Hi everyone, I'm currently setting up my first multilingual project on a brand new 2.4 install. One of the things I tried to find out is how to change the default language. Fortunately I'm not the first one and I found good solutions. While reading through a lot of stuff I stumbled upon the suggestion to change the language of the guest user here and here. So I tried that and always get the error: "The guest role is required". Despite the error the language change gets saved. Two other users also reported this here and here. Like Relmos reports, after switching the guest user language, my site also displays in the default language. I checked with <?php echo $user->language->name; ?> in Chrome Incognito mode. This raises 2 questions: 1. Is setting the guest user language really affecting the language displayed on the home page or is it only determined by what language I set the default language to (like explained here)? 2. Can anybody reproduce the error message when switching language of guest user and what does it mean? The guest role is still there after switching. So I don't quite understand the meaning of that error message. Patiently awaiting partial enlightenment through this great community gerhard
  22. Hi Joss, I wish I could do that also. There's plenty of space in my garden but unfortunately the clients are not willing to pay for transition to PW :-(
  23. I spent the last 10 days or so fiddling around with some Joomla/Seblod installs that I have to maintain and totally missed out on the PW2.4 release. Now I quickly updated the config.php of my pwfoundation5 template on github to reflect all the changes.
  24. @Sérgio, thanks a lot for your help! I was not aware of the update issue with Foundation and will add the link to the readme. For production sites, I guess most people are still using PW2.3. But for those who want to use 2.4 I would like to add an alternative config.php to my repo. Could you please open an issue on github and paste your complete working config.php for PW2.4 there? I will then include it as an alternative in the repo. That would be great. Cheers gerhard EDIT: config.php is updated to 2.4 version
×
×
  • Create New...