Jump to content

OllieMackJames

Members
  • Posts

    356
  • Joined

  • Last visited

Everything posted by OllieMackJames

  1. Please do not tell me about the great modules that can do this a different way, I know those. I NEED htaccess 301 redirect fallback to properly work. When I add this: Redirect 301 /old.html /new-loaction/ Processwire somehow shows this: http://www.domain.com/new-location/?it=old.html with a 404 error and Warning: filemtime(): stat failed errors as well I tried this on a different domain with a different cms - modx evolution and that adds something else to the end - that is why I conclude it must be something that processwire adds. How can I get the htaccess 301 redirect to work with processwire, WITHOUT the great modules jumplinks and apeisa's redirect. Thanks!
  2. Thanks, that should do it, I already made an external language.php file where I added the $domain_name = "domein naam" etc. etc This seems to work fine except when within functions in other php files, then the $domain_name throws an unknown variable for $domain_name Anybody know how to do this, except to go into the functions themselves and specify there as well. Thanks!
  3. OK, just spent and lost a couple of hours getting translation to work for processwire working wit stuff like: <?php echo __('Slogan') ?> and then in setup language make alternatives for those files Then I set the profile language to the new one and all works great. Forward 2 hours of changing all stuff in files and then check the site on a different computer and I only see the old stuff! When logged out on the computer I was working on, same stuff happens. Wow, that is interesting... What I have is a number of static texts that need changing templates so that VISITORS see the correct text. I use same design for different sites/domains for different countries I want to make the design changes on one site and then just roll out. Apparently the processwire language module that I used is not for that. Much appreciated if someone could tell me how to do this. It is about stuff like domain name = domein naam add to cart = in winkelwagen must see = aanbevolen etc. etc. These terms will be used in different templates so it would be best if I could specify all this stuff in an external file that has different language versions. Then in one place in a sort of globals.php file I would include this file or the other language version. Anybody know how to do this? I am a happy user of pw, but programming is beyond me, copy paste I know. Thanks for any help
  4. Found it already, posting for others and my own leaky memory... <div class='action'><a class='add-to-cart-button' href='" . $plan->page_field . "'><span>".__('ADD TO CART')."</span></a></div> needed to close stuff off with " and then start and end with dots, .__('ADD TO CART').
  5. I have a salespage that has some parts of the design that need translating depending on the language. In the following code I have placed __('ADD TO CART') but something goes wrong, the front end now shows this in the button text I have one more instance of a translate in the code __('Most popular'), also not working, here's the code: <?php function getProductOptions($page) { $availableProductOptions = wire('page')->available_product_options; $options = "<ul>"; foreach ($availableProductOptions as $option) { if ($page->get($option)) { $options .= "<li class='check'><span>" . $option->title . "</span></li>"; } else { $options .= "<li class='lack'><span>" . $option->title . "</span></li>"; } } $options .= "</ul>"; return $options; } function getProductPlans() { $out = ""; $bestValue = null; foreach (wire('page')->product_plans_repeater->find('limit=3') as $plan) { $planOptions = ""; $price = explode('.', $plan->t_field_2); $price = "$price[0]<sup>.$price[1]</sup>"; $arrow = ""; $label = "<h2 class='most-popular-label empty'> </h2>"; if ($plan->checkbox_field && !$bestValue) { $bestValue = $plan->plan_color->title; $arrow = "<div class='arrow " . $bestValue . "'> <div class='best-value '> <div class='inner'> " . wire('page')->t_area_5 . " </div> </div> </div>"; $label = "<h2 class='most-popular-label'><span>__('Most popular')</span></h2>"; } $out .= " <div class='plan " . $plan->plan_color->title . "'> " . $label . " <div class='inner'> <header> <p>" . $plan->t_field . "</p> <span itemprop='name'>" . $plan->t_field_1 . "</span> </header> <div itemprop='price' class='price'>" . $price . "</div> <div class='options'>" . getProductOptions($plan->custom_pages_field) . "</div> <div class='action'><a class='add-to-cart-button' href='" . $plan->page_field . "'><span>__('ADD TO CART')</span></a></div> </div> " . $arrow . " </div> "; } if ($bestValue) { $out .= " <div class='best-value " . $bestValue . "'> <div class='inner'> " . wire('page')->t_area_5 . " </div> </div> "; } echo $out; } ?> thanks!
  6. <footer> <div class='row'> <div class='copy'> <p><img class='footer-logo' src='/img/footer-logo.png' alt='<?php echo __('Domain Slogan') ?>' width='173' height='37' /></p><?php echo __('2003 - 2015 domain.com All Rights Reserved.') ?> </div> <nav class='footer-nav'> <ul> <?php echo $nav ?> </ul> </nav> <div class='author'><?php echo __('2003 - 2015 domain.com All Rights Reserved.') ?> </div> </div> </footer> If I go to the translate thing in pw setup languages and load the file above the following works everytime: <?php echo __('Domain Slogan') ?> But the second one does not work, yet it is the exact same as the third one, only placed differently. This one does not work: <?php echo __('2003 - 2015 domain.com All Rights Reserved.') ?> This one works: <div class='author'><?php echo __('2003 - 2015 domain.com All Rights Reserved.') ?> </div> Anybody know what I am doing wrong here? Thanks!
  7. OK, I see we are on 4.4.6 and ckeditor is already version 4.5.1 - just downloaded and checked and it is changed in there already. Guess we just need to wait till this is incorporated in PW latest. Until then the workaround above works for whoever needs it.
  8. In Firefox 36 source text is not wrapped in the Source box of CKEditor. I am on processwire 2.6.7 I made the following change in /public_html/wire/modules/Inputfield/InputfieldCKEditor/ckeditor-4.4.6/skins/moono/editor_gecko.css .cke_reset_all textarea{white-space:pre} to .cke_reset_all textarea{white-space:pre-wrap} Anybody know how else to fix this or how to get this into the processwire distro? Mozilla ticket that refers to this: https://support.mozilla.org/fr/questions/1050456 Fix above works for me, posting here for others who run into same trouble and in hope of change in pw-distro-ckeditor. tnx.
  9. @LostKobrakai, thanks, I tried it all without the .html extension and still no luck, any ideas how to get this working? I am not a coder, I can only copy paste, that is probably why I do not get this going yet. Anybody willing to get access to the test site to get it working, I will then do a proper write up for other dummies like me who might have use for it. Thanks!
  10. Finally getting around to working on this. But running into trouble. I have a site that is very important business wise for me, (it does very well in the search engines) and it uses .html extension for all pages directly off root It now still runs on modx evolution but now is the time to port to pw. I am not ready to try out redirects because no one will guarantee that this will give me the same serp results as I am getting now, so that is not an option. I have got one part working on a test site, which is getting the url to link to show each article living directly off root, I used this code in _init.php: wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'article') { // ensure that pages with template 'article' live off the root rather than '/posts/' $event->replace = true; $event->return = "/$page->name.html"; } }); So far so good: when I go to the home page (and any other page: it shows all links to articles as living off root with an .html extension. But this is where it stops working. I set allow urlsegmetns to yes on home.php template and added the following to home.php template: if(strlen($input->urlSegment2)) { // we only accept 1 URL segment here, so 404 if there are any more throw new Wire404Exception(); } else if(strlen($input->urlSegment1)) { // render the blog post named in urlSegment1 $name = $sanitizer->pageName($input->urlSegment1); $post = $pages->get("/tuning-tips/")->child("name=$name"); if($post->id) echo $post->render(); else throw new Wire404Exception(); } But I keep getting 404 errors, it does not show the page. when going to the /directly-off-root.html url. My setup on the site is like follows: home =>/category1toplevelpage/ => =>/category1toplevelpage/article1 => =>/category1toplevelpage/article2 => =>/category1toplevelpage/article3 => =>/category1toplevelpage/articleetcetc =>/category2toplevelpage/ => =>/category2toplevelpage/article1 => =>/category2toplevelpage/article2 => =>/category2toplevelpage/article3 => =>/category2toplevelpage/articleetcetc What code should I put where to get this to work properly? Help much appreciated! Thanks.
  11. Hotlinking Cloudfront solution: s3 has bucket policy that you can instruct to only allow images get commands from certain domains and or IP's. But cloudfront does not have this, so this only prtects from direct linking to your s3 files. You can apply some level of defensive tactics to limit hotlinking to your cloudfront distributions. Here's what I figured out: 1 - On cloudfront create a second distribution that you connect to the same bucket that you are already using, wait for it to fully deploy, then: 2 - Check if ithe files can be served from the new cloudfront distribution, then in PW amazons3/loudfront module, change domain name of cloudfront distribution to new distribution, check if all works and disable the old distribution, it can be deleted it you like (I would if I know it is being used for hotlinking). This does not stop hotlinking right away, but allows you to stop images from being served from your cloudfront distribution as soon as you switch. The hotlinking sites will now no longer have images showing up and will have to go to your site and get the new locations. At least it is an easy defense technique to protect against paying for traffic for images not served via your site. Not fool proof, but it slows things down and makes it harder for leaches... BTW, it is wise to apply a cache-control http header to the s3 bucket and get the distribution to use this, so your images are served with cache control headers, saves you from unnecessary traffic costs on your s3 account. Would be nice to see this module working together with the minimize solution module. That would really make things easy!
  12. Very much interested in this module, but I need it to work together with the amazons3cloudfront module. I want all images - compressed - served from cloudfront cdn, so how can this be made to work with that? Thanks!
  13. One question regarding hotlinking: How can I prevent hotlinking to my s3/cloudfront images by someone else from another domain? thanks!
  14. A few things have changed regarding amazon s3 and cloudfront, I have made a checklist that takes you step by step through setting it all up, works like a charm, posting here in case I forget the steps myself for next site... 1 - Set up a bucket for this site on amazon s3 2 - make sure it is on us standard 3 - go to Account => security credentials => get started with IAM users 4 - create new user 5 - download user security credentials 6 - select user and go to Inline Policy 7 - Create User Policy 8 - { "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1425901261000", "Effect": "Allow", "Action": [ "s3:DeleteObject", "s3:GetObject", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": [ "arn:aws:s3:::name-of-bucket/*" ] } ] } 9 - go to PW admin and install the amazons3cloudfront module 10 - enter the AWS acces key and secret key for the user you have created 11 - enter the name of the bucket you have created 12 - test the module to see if images are uploaded to the bucket 13 - go to a page in PW and drag & drop an image 14 - refresh the page on the amazon s3 console and you will see the image there in the file and page folder 15 - go to amazon aws console and go to cloudfront 16 - Create Distribution 17 - Web distribution => Get Started 18 - Origin Domain Name => from dropdown choose the bucket you want 19 - Restrict Bucket Access - NO 20 - Create Distribution 21 - Allow the distributiion time to deploy and once status is deployed, it can be used 22 - copy domain name of distribution for entry in PW Admin of module That's it, test and enjoy!
  15. Just today tested the module on a pw 2.5.22 site and apart form the figuring out how to set stuff up with s3 bucket, policy and cloudfront distribution, all worked like a charm Thanks lots zyON!
  16. Today updated one site from stable to latest dev 2.5.18 no trouble whatsoever, all works great. Anybody any idea when it is ok run this on production sites? Thanks for such a wonderful CMS!
  17. anybody know where I can find the iridium profile? thanks!
  18. But once I go down from the root of this site down one or two directories like: /procws/directory I lose the image again, now it geos relative to this directory again... Any ideas? OK this one works: <?php echo $config->urls->root ?> But now the images on the page itself while inserted in the article, do not show up...
  19. Thanks BitPoet, that did not work yet. I tried different things and this one did work: <img src="<?php echo $config->urls->templates->url ?>site/templates/bbp/img/logo.jpg" alt="Home" width="282" height="78" />
  20. I have a site that I am porting to another language. I therefore export the profile and install the new site on a directory off-root on the new location /procws From there I can translate and when ready upload it to root Now here's the trouble: while working in a directory /procws I can not get the logo and some other images to show and it has to do with the template This is what I have: <html><head> <title><?=$page->{'alt_title|title'}?></title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="description" content="<?=$page->meta_description; ?>" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <link rel="stylesheet" href="<?php echo AIOM::CSS(array('bbp/css/kickstart.css', 'bbp/style.css')); ?>"> <script src="<?php echo AIOM::JS(array('bbp/js/prettify.js', 'bbp/js/kickstart.js')); ?>"></script> </head><body> <div class="grid"> <div id="wrap" class="clearfix"> <header class="col_12"> <div class="col_4"><a href="/"><img src="/site/templates/bbp/img/logo.jpg" alt="Home" width="282" height="78" /></a></div> stylesheets work ok, but this does not: <img src="/site/templates/bbp/img/logo.jpg" alt="Home" width="282" height="78" /> What should I use there so processwire shows the logo regardless where processwire is installed, just takes it from that installation folder. Thanks!
  21. OK, got it figured out, posting here in case others run into same trouble. I had the old export profile installed, then manually uploaded the newest version, but I only uploaded this file: ProcessExportProfile.module Turns out I should have uploaded the whole directory called: ProcessExportProfile In that directory there were the following things: - config.php - site-skel directroy with subdirecdtories assets/install/modules/templates with repsective files in there - ProcessExportProfile.module - README.md After upload of whole module with all directories and files all worked great again. Thanks for a great module btw!
  22. Problem solved, posting solution in case others run into same stuff. The error had to do with php 5.6 ssl certificate verification. I got this error message(s): - fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed - fsockopen(): Failed to enable crypto - fsockopen(): unable to connect to ssl://xx.xx.xx:443 (Unknown error) I am on a freebsd 9.3 server and followed these steps to get things sorted out, posting here to help others who might run into same trouble. Logged in via ssh - # locate cert.pem - on my server it was found in /usr/local/etc/ssl/cert.pem - added following to php.ini: openssl.cafile=/usr/local/etc/ssl/cert.pem - restart httpd service Problem solved, so it had nothing to do with processwire, but my update to php 5.6, good luck!
  23. thanks adrian, not sure if that is what the trouble is here. I went into config.php and set the debug to true and this is what shows: Warning: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /xxxxxxxxxxxxxxxxxxxxxx/public_html/wire/core/WireHttp.php on line 428 Warning: fsockopen(): Failed to enable crypto in /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/public_html/wire/core/WireHttp.php on line 428 Warning: fsockopen(): unable to connect to ssl://api.github.com:443 (Unknown error) in /xxxxxxxxxxxxxxxxxxxxx/public_html/wire/core/WireHttp.php on line 428 Anybody have an idea what the trouble is here? Thanks!
×
×
  • Create New...