-
Posts
926 -
Joined
-
Last visited
-
Days Won
1
Everything posted by PWaddict
-
@Mike Rockett There are 3 problems with the module: 1. The iso for the default language as @maxf5 mentioned. 2. Some pages are completely ignored 3. Wrong sitemap markup. Each link must have it's alternate links not just the default one. I'm currently using the below method for a proper multi-language sitemap. 1st step Create a php file "sitemap-xml-multilanguage.php" with the below code and add it on /site/templates/ folder. <?php namespace ProcessWire; if (!wire('modules')->isInstalled('LanguageSupportPageNames')) throw new WireException('Missing module: LanguageSupportPageNames'); // Exclude pages here function selectors() { $selectors = array( '', // E.g. template!=variations ); return implode(',',$selectors); } function renderSitemapPage(Page $page) { $out = ''; foreach (wire('languages') as $lg) { if (!$lg->isDefault() && !$page->{"status$lg->id"}) continue; $out .= "\n<url>" . "\n\t<loc>" . $page->localHttpUrl($lg) . "</loc>" . renderSitemapAlternateLangs($page) . "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>" . "\n</url>"; } return $out; } function renderSitemapChildren(Page $page) { $out = ''; $newParents = new PageArray(); $children = $page->children(selectors()); foreach($children as $child) { $out .= renderSitemapPage($child); if($child->numChildren) $newParents->add($child); else wire('pages')->uncache($child); } foreach($newParents as $newParent) { $out .= renderSitemapChildren($newParent); wire('pages')->uncache($newParent); } return $out; } function renderSitemapAlternateLangs(Page $page) { $out = ''; foreach(wire('languages') as $lg) { if (!$lg->isDefault() && !$page->{"status$lg->id"}) continue; $iso = $lg->language_iso_code; // Custom text field for ISO under system's language template $out .= "\n\t<xhtml:link rel=\"alternate\" hreflang=\"$iso\" href=\"".$page->localHttpUrl($lg)."\"/>"; } return $out; } function renderSitemapXML(array $paths = array()) { $out = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">'; array_unshift($paths, '/'); foreach($paths as $path) { $page = wire('pages')->get($path); if(!$page->id) continue; $out .= renderSitemapPage($page); if($page->numChildren) $out .= renderSitemapChildren($page); } $out .= "\n</urlset>"; return $out; } header("Content-Type: text/xml"); echo renderSitemapXML(); Note: The above code if I remember correctly is based on @ryan and @kixe code. 2nd step Add the new template "sitemap-xml-multilanguage" in PW and under URLs tab on "Should page URLs end with a slash?" select "No". 3rd step Create a new page under "Home" with the title "sitemap.xml" by using the "sitemap-xml-multilanguage" template. Final step Create a text field with the name "language_iso_code" and add it under system's language template under "Setup > Templates > Show system templates? > Yes. Then on each language under "Setup > Languages" you will have to add the iso name. This is useful for the default language. Here are the results I'm getting on http://localhost/mysite/sitemap.xml with my method: <urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"> <url> <loc>http://localhost/mysite/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/"/> <lastmod>2017-09-02</lastmod> </url> <url> <loc>http://localhost/mysite/en/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/"/> <lastmod>2017-09-02</lastmod> </url> <url> <loc>http://localhost/mysite/nea/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/"/> <lastmod>2017-08-27</lastmod> </url> <url> <loc>http://localhost/mysite/en/news/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/"/> <lastmod>2017-08-27</lastmod> </url> <url> <loc>http://localhost/mysite/parastaseis/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/"/> <lastmod>2017-08-07</lastmod> </url> <url> <loc>http://localhost/mysite/en/shows/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/"/> <lastmod>2017-08-07</lastmod> </url> <url> <loc>http://localhost/mysite/omada/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/omada/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/meet-the-team/"/> <lastmod>2017-08-25</lastmod> </url> <url> <loc>http://localhost/mysite/en/meet-the-team/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/omada/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/meet-the-team/"/> <lastmod>2017-08-25</lastmod> </url> <url> <loc>http://localhost/mysite/epikoinwnia/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/epikoinwnia/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/contact/"/> <lastmod>2017-09-02</lastmod> </url> <url> <loc>http://localhost/mysite/en/contact/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/epikoinwnia/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/contact/"/> <lastmod>2017-09-02</lastmod> </url> <url> <loc>http://localhost/mysite/nea/test-4/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-4/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-4/"/> <lastmod>2017-08-14</lastmod> </url> <url> <loc>http://localhost/mysite/en/news/test-4/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-4/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-4/"/> <lastmod>2017-08-14</lastmod> </url> <url> <loc>http://localhost/mysite/nea/test-3/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-3/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-3/"/> <lastmod>2017-08-11</lastmod> </url> <url> <loc>http://localhost/mysite/en/news/test-3/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-3/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-3/"/> <lastmod>2017-08-11</lastmod> </url> <url> <loc>http://localhost/mysite/nea/test-2/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-2/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-2/"/> <lastmod>2017-08-11</lastmod> </url> <url> <loc>http://localhost/mysite/en/news/test-2/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-2/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-2/"/> <lastmod>2017-08-11</lastmod> </url> <url> <loc>http://localhost/mysite/nea/test-1/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-1/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-1/"/> <lastmod>2017-08-11</lastmod> </url> <url> <loc>http://localhost/mysite/en/news/test-1/</loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-1/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-1/"/> <lastmod>2017-08-11</lastmod> </url> <url> <loc> http://localhost/mysite/parastaseis/test/ </loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/test/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/test/"/> <lastmod>2017-09-04</lastmod> </url> <url> <loc> http://localhost/mysite/en/shows/test/ </loc> <xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/test/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/test/"/> <lastmod>2017-09-04</lastmod> </url> </urlset> and here are the results from your module: <urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"> <url> <loc>http://localhost/mysite/</loc> <lastmod>2017-09-02T05:37:50+03:00</lastmod> <xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/"/> </url> <url> <loc>http://localhost/mysite/parastaseis/</loc> <lastmod>2017-08-07T09:51:08+03:00</lastmod> <xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/parastaseis/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/"/> </url> <url> <loc> http://localhost/mysite/parastaseis/test/ </loc> <lastmod>2017-09-04T11:06:36+03:00</lastmod> <xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/parastaseis/test/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/test/"/> </url> <url> <loc>http://localhost/mysite/omada/</loc> <lastmod>2017-08-25T20:27:09+03:00</lastmod> <xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/omada/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/meet-the-team/"/> </url> <url> <loc>http://localhost/mysite/epikoinwnia/</loc> <lastmod>2017-09-02T04:10:51+03:00</lastmod> <xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/epikoinwnia/"/> <xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/contact/"/> </url> </urlset> I hope it can help you fix your module.
-
@horst @tpr After closing the modal the hover tooltip appears and it feels like a glitch cause it also half-cover the button preview. I fixed it by replacing the 34 line on InputfieldCroppableImage3.js with this: items: 'a:hover' Thank you very much guys for your work
-
Works great. One small fix from me. After saving the page or revisiting it I'm seeing a previous cached icon-size thumb. This happening even on localhost. So, I fixed it by replacing the 155 line on InputfieldCroppableImage3.module with this: $out .= $warning ? '' : " <img src='{$pagefile->getCrop($suffix)->height(48)->url}?nc={$pagefile->mtime}' alt='' />"; // added a small indicator thumb to each crop-button
-
I'm currently testing it on localhost. It doesn't load the original thumb. It loads an image that doesn't exists. Original thumb testing.-thumbnail.jpg Currently loads this non available image testing.-thumbnailn.jpg You have to modify the js code to remove the cropping values too. I'm using cropping = north. That's why the "n".
-
Using this js fix or not when I press "Accept Crop" and the modal closes the icon-size thumb disappears. I'm getting this error on console: Failed to load resource: the server responded with a status of 404 () testing.-thumbnailn.jpg. This issue happens only after you saved the page. It should load the file as testing.-thumbnail.0x48n.jpg. The timestamp also must be used on that too in order to get always the last modified thumb and not the very first cached one.
-
@justb3a Yep already using CroppableImage3 but it was acting weird and I was looking for alternatives but I don't think I will need them.
-
@horst I fixed the cache problem on cropping by replacing the 145 line on ProcessCroppableImage3.module with this: 'imageUrl' => $imageUrl . "?nc=" . $img->mtime, I noticed that the Variations page is showing cached versions of my images too. I think all this is caused by Cloudflare's cache. I guess I have to find out how to disable it on the admin section of PW. EDIT: Since the images have the same url on both frontend and backend then there is no point to disable cache on backend right? The solution would be to add "?nc=" query on the Variations images too. The Variations page belongs to the core, not to your module right?
-
Can't you see the screenshot I posted above? The modal cropping should load the non-cache version of the image with the last modified timestamp. Currently it loads the image like this which is wrong as here we get the very first cache version of the image with it's previously dimensions 1244 x 829 pixels: <div class="jcrop-holder" style="width: 1244px; height: 829px; position: relative; background-color: rgb(0, 0, 0);"> <img src="/mysite/site/assets/files/1028/mg_6550_copy.jpg" style="border: none; margin: 0px; padding: 0px; position: absolute; width: 1244px; height: 829px; top: 0px; left: -139px;"> <img src="/mysite/site/assets/files/1028/mg_6550_copy.jpg" data-width="1400" data-height="1050" alt="" style="border: none; margin: 0px; padding: 0px; position: absolute; width: 1244px; height: 829px; opacity: 0.6;"> But since I changed the dimensions from the field settings it should be loaded like this with the current image dimensions 1400 x 933 pixels: <div class="jcrop-holder" style="width: 1400px; height: 933px; position: relative; background-color: rgb(0, 0, 0);"> <img src="/mysite/site/assets/files/1028/mg_6550_copy.jpg?nc=1504572955" style="border: none; margin: 0px; padding: 0px; position: absolute; width: 1400px; height: 933px; top: 0px; left: -139px;"> <img src="/mysite/site/assets/files/1028/mg_6550_copy.jpg?nc=1504572955" data-width="1400" data-height="1050" alt="" style="border: none; margin: 0px; padding: 0px; position: absolute; width: 1400px; height: 933px; opacity: 0.6;">
-
@horst @tpr Here is why the cropping result is always different from the area I selected: On the cropping modal it loads a cached image version where I previously had the image dimensions at 1244 x 829 pixels but currently it's 1400 x 933 pixels. If the non-cache image is loaded I bet it will fix the problem.
-
If you mean the icon-size issue I haven't test it on repeaters. I'm just saying that if it will ever work for me it will be useful on repeaters since there is a bug there where the hover isn't triggered.
-
The problem still exists. The icon-size is useful for me only on repeaters where the button hover image isn't displaying at all.
-
Hi @justb3a I just found your module and I was wondering if you could add a cropping option field with all of it's values: northwest, north, northeast, west, center, east, southwest, south, southeast.
-
The hover on button is always displaying the correct image. The problem is on the icon-size one. I do not get any js error but sometimes I'm getting this filename: test.-thumbnail.0x48.jpg while others I'm getting this: test.-thumbnail.jpg. I noticed when it's properly working it starts with this: test.-thumbnail.jpg, then with this test.-thumbnail.jpg?v=1, then with this test.-thumbnail.jpg?v=2 but If the page refreshed and crop again it starts again with test.-thumbnail.jpg, test.-thumbnail.jpg?v=1, test.-thumbnail.jpg?v=2 but without displaying the correct image.
-
@horst On a different page (from the same site of course) I've upload the image with the original filename _MG_6550_copy.jpg and the cropping works properly. Also, the button preview will not always update. This is really messed up and tomorrow I have to give access to my client so he can start adding content. If he gets those issues I guess I will uninstall the module and use the core images field with the fixed crops.
-
It might be a cache issue and not filename related.
-
@horst It was the filename of the image that causing the problem. The filename was _MG_6550_copy.jpg and I changed it to test.jpg and now I can crop it properly. The button preview works too The _MG_6550_copy.jpg when uploaded it gets auto renamed to mg_6550_copy.jpg and it works fine on locahost but I don't understand why it doesn't work with that filename on the server too. What's wrong about mg_6550_copy.jpg ?????
-
@horst I switched back to 1.1.7 and I still have the cropping problem on the server. It doesn't crop exactly the area I choose. I don't understand how is this possible to happen???? On another site on the same server with the same 1.1.7 version it crops properly.
-
@horst @tpr The button preview never update on a production server. On localhost it's working properly. The cropping is broken on a production server. The area I choose to crop is always different on the Accept/Redo Crop screen. On localhost it's working properly. I'm using the version 1.1.10 on both localhost and the server.
-
@tpr Here is how I'm cropping them: $thumb_medium = $photo->photos_main_photo->getCrop("thumbnail", "width=660"); $thumb_small = $photo->photos_main_photo->getCrop("thumbnail", "width=480"); $thumb_x_small = $photo->photos_main_photo->getCrop("thumbnail", "width=360"); I do not use the markupsrcset module. Is there something I could do to change the syntax or it has to be changed from the CI3 module side?
-
@horst I think that I found why the variations aren't removing. Their syntax is different. Variations test.-thumbnail.jpg (Predefined Crop) test.-thumbnail.0x48n.jpg (New tiny thumbnail) test.360x0n-thumbnail.jpgtest.480x0n-thumbnail.jpgtest.660x0n-thumbnail.jpg As you can see the 360, 480 & 660 variations that I want to get removed have different syntax.
-
Thank you @horst for the new tiny thumbnail. It's very useful for repeaters where the hover isn't working on them. When I crop my predefined crop "thumbnail" it doesn't remove it's variations: test.360x0n-thumbnail.jpg test.480x0n-thumbnail.jpg test.660x0n-thumbnail.jpg Isn't the removal of CropImage children suppose to remove the above 3 variations so when the frontend page is re-visited those variations will be auto generated again with the new crop version?
-
I've just upgrade it to the new version. I selected my thumbnail predefined crop and then I cropped a new area of the thumbnail but NONE of the variations removed. What I'm doing wrong?
-
Hello! I'm using the following code to ajaxify my website with HTML5 History. It works great with back/forward broswer's buttons but how can I make it load ONLY new pages with scrollTop(0); ? If the back/forward broswer's buttons pressed it should use the saved scroll position as it's currently happens. $(function(){ var replacePage = function(url) { $.ajax({ url: url, type: 'get', dataType: 'html', success: function(data){ var dom = $(data); var title = dom.filter('title').text(); var html = dom.filter('.ajax-container').html(); $('title').text(title); $('.ajax-container').html(html); } }); } $(document).on('click', 'a:not(.external)', function(e){ history.pushState(null, null, this.href); replacePage(this.href); e.preventDefault(); }); $(window).bind('popstate', function(){ replacePage(location.pathname); }); });
-
Your images field name is images not myphoto. That's the problem.
-
Maybe you're accidentally hiding the image with CSS?