Jump to content

Leftfield

Members
  • Posts

    99
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Leftfield

  1. Hey @ryanThanks for the Autolinks module! I thought about making something like this :D but I am laughing at myself and my abilities. Is there a dedicated Forum page for it (I couldn't find one), or will there be one? I wouldn't like to change the code manually because of future updates, but I would like to discuss some features I think the module should have, like adding an option for choosing templates (or excluding them) where it should work. It is uber important from an SEO point of view to control where links come from and to what pages. The architecture of inner linking is a really important signal.
  2. Yes @wbmnfktr (now I count bottles of whiskey I own you), I am on my mobile, waited to come home to sit down by the computer to post here, but you posted before me. In the end, I found out it was my server blocking the outgoing SMTP connection. The module is working great! Still waiting the host to unlock it.
  3. Hello @All I got a problem. Latest PW, same PHP 8.1 When sending from Localhost everything is working fine. When sending from my website I got "Connection refused". Error log: module/edit?name=WireMailSmtp&collapse_info=1 Error in hnsmtp::send : cannot connect to smtp-server! I've tried to change Hostname of this computer but no luck. Using smtp.zoho.com, port 465, SSL checked
  4. @kixethat's a great solution!!! But, reducing database queries is a priority for me. So, here's a straightforward approach to prevent bloating: Example: I use a button with descriptions on various parts of the different pages. I needed a simple solution to change everything in one place, not to edit every page. So I made global-button.php (and more similar files for the same purpose) and called it wherever it needed to be with <?php include('global-button.php'); ?> So now I have only one page to edit, and voila. Hope this will help someone.
  5. Yes, it is a custom (multilingual-ready) module. I thought I would write a solution here when I found a fix.
  6. My whole website is messed up. When I was installing modules for multilanguage support, I got the following errors: PHP 8.1.0 ProcessWire: 3.0.229 On the front: Warning: foreach() argument must be of type array|object, null given in ...\wire\modules\LanguageSupport\LanguageSupportPageNames.module on line 126 In the backend: Warning: foreach() argument must be of type array|object, null given in ...\wire\modules\LanguageSupport\LanguageSupportPageNames.module on line 126 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in ...\wire\modules\LanguageSupport\ProcessLanguage.module on line 340 ( ! ) TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in ...\wire\modules\LanguageSupport\ProcessLanguage.module on line 340
  7. Hi Alexander, can you please help me? I got an email to mark the post (it is yours) to mark it as the solution. I am looking for the last hour where it is the button but I have no idea. Do you know?

    1. wbmnfktr

      wbmnfktr

      Go to the first post, click on edit and add [SOLVED] to the beginning of the title and that will do it.

  8. I've just tried and it worked like a charm. I will go nuts
  9. Hey @ceberlin thanks!!! I thought to do it anyway and add more functionalities in the next update. For now, change the function checkTextLength in SeoTextWidth.js // Text length checking and warning (updated) function checkTextLength(input, fieldConfig) { const span = $('<span class="detail"></span>').insertAfter(input); input.keyup(function() { const text = $(this).val(); const width = Math.round(calculateTextWidth(text, fieldConfig.font)); // Round to whole number if (width > fieldConfig.maxWidth) { span.html(`<i class="fa fa-exclamation-circle"></i> <span class="text-danger">Warning:</span> Text exceeds max width (${fieldConfig.maxWidth}px).`); span.addClass('text-danger'); } else { span.text(`Estimated Width: ${width}px`); // Display rounded value span.removeClass('text-danger'); } }); }
  10. @BrendonKozNo. The Validator validated every 10th time. Once, the tweet pulled the full image. Once, it created space but an empty image. Several times, it created a thumbnail with no image, too. I will try HTML and another server tomorrow first thing in the morning. I tried from the same server, another website in ProcessWire, and it worked. Not anymore. (edit) I tried with another CMS from another server; it was a different CMS, and it worked.
  11. @BrendonKozI've tried that. But I'm going to try it again right now and will let you know. Thanks for the effort, mate!
  12. @BrendonKozthanks for helping me!!! I've tried the non-minimized version (it worked before as-is). I even changed the brackets at the end from "/>" to ">" and back. It's incredibly frustrating because I have no idea what to do, and I'm not server-oriented enough to test it from that side, like ports. I believe I've missed something, but I can't see it.
  13. I don't want to share a link here (it is my signature), but I have a problem: when sharing a link on Twitter (X), it doesn't pull images anymore. The problem started "recently," and I can't replicate it. I rewrote the code, removed it, and placed it again, cleared the cache every time, tried with meta twitter:image:src, had a look at the cpanel (no IP blocked), read about 100 websites, and I am completely powerless. I hoped someone here could help me. I got the following error when using the Twitter Card Validator: ERROR: Failed to fetch page due to: HttpConnectionTimeout
  14. It is ready. Sorry for the second post. Kind regards and thanks!
  15. Hey @ryan:) In the meantime, I updated the module, and TBH, I wasn't sure if it meets the conditions for the listing in the module directory. I look forward to sharing it (and hopefully updating it with more functionality).
  16. @BrendonKozthanks mate! I have to try it. Brilliant! @bernhard Yes, for me, it is a fun little thing but very useful. Here's screenshot attached.
  17. Hi @All, I made the page with only admin access so I can check in frontend visually (a chart) and links - what pages are most linked from blog pages and where I forgot to use this opportunity. This is important for SEO and removes manual labor. If you have any suggestions, feel free to shoot. Simple explanation: I got template=post and want to see stats with inner links to the homepage and service pages. Thanks @poljpocketfor helping me out! <?php namespace ProcessWire; // Calculate Internal Link Counts and Linked Pages $pages = wire('pages'); // Get all relevant pages directly in one query $relevantPages = $pages->find("template=post|service|home"); $blogPosts = $relevantPages->find("template=post"); $mainPages = $relevantPages->find("template=home|service"); // Function to check if a post DOES NOT link to ANY PUBLISHED service OR home page /** @var PageArray $mainPagesLinks */ $mainPagesLinks = $wire->wire(new PageArray()); foreach ($mainPages as $mainPage) { // this will remove duplicates by default $mainPagesLinks->append($mainPage->links("template=post")); } // Calculate Internal Link Counts and Linked Pages $linkCounts = []; $linkedPages = []; foreach ($relevantPages as $page) { $linkCounts[$page->id] = 0; $linkedPages[$page->id] = []; if ($page) { $items = $page->links(); if ($items->count()) { foreach ($items as $item) { if ($item->template != 'admin') { $linkCounts[$page->id]++; $linkedPages[$page->id][] = $item; } } } } } arsort($linkCounts); // Prepare data for the circle chart $chartLabels = []; $chartValues = []; foreach ($linkCounts as $pageId => $count) { if ($count > 0) { $page = $pages->get($pageId); $chartLabels[] = $page->title; $chartValues[] = $count; } } ?> <div class="container py-5 mb-5 links"> <div class="row py-5"> <div class="col-12 col-md-4 offset-md-4 pb-5"> <canvas id="linkCountChart" width="200" height="200"></canvas> </div> <div class="col-12 col-md-8 offset-md-2"> <div class="accordion" id="internalLinksAccordion"> <?php foreach ($linkCounts as $pageId => $count): ?> <?php if ($count > 0): ?> <?php $page = $pages->get($pageId); ?> <div class="accordion-item"> <h2 class="accordion-header" id="heading<?= $page->id ?>"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse<?= $page->id ?>" aria-expanded="false" aria-controls="collapse<?= $page->id ?>"> <?= $page->title ?> (<?= $count ?>) </button> </h2> <div id="collapse<?= $page->id ?>" class="accordion-collapse collapse" aria-labelledby="heading<?= $page->id ?>" data-bs-parent="#internalLinksAccordion"> <div class="accordion-body"> <?php if (!empty($linkedPages[$page->id])): ?> <ul> <?php foreach ($linkedPages[$page->id] as $linkedPage): ?> <?php if ($linkedPage->template != 'service'): ?> <li><a href="<?= $linkedPage->url ?>"><?= $linkedPage->title ?></a></li> <?php endif; ?> <?php endforeach; ?> </ul> <?php else: ?> <p>No internal links found for this page.</p> <?php endif; ?> </div> </div> </div> <?php endif; ?> <?php endforeach; ?> </div> <h3 class="pt-5">Posts without Links to Service and Home Pages</h3> <table class="table"> <thead> <tr> <th>Post Title</th> <th>Edit Link</th> </tr> </thead> <tbody> <?php // echo results foreach ($blogPosts as $post) { if (!$mainPagesLinks->has($post)) { echo "<tr>"; echo "<td><a href=\"{$post->url}\">{$post->title}</a></td>"; echo "<td><a href=\"{$post->editUrl}\">Edit</a></td>"; echo "</tr>"; } } ?> </tbody> </table> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> document.addEventListener('DOMContentLoaded', function () { // Chart data is now defined within the JavaScript scope const chartData = { labels: <?= json_encode($chartLabels); ?>, datasets: [{ data: <?= json_encode($chartValues); ?>, backgroundColor: [ 'rgba(255, 99, 132, 0.8)', 'rgba(54, 162, 235, 0.8)', 'rgba(255, 206, 86, 0.8)', // Add more colors as needed ], }] }; const ctx = document.getElementById('linkCountChart').getContext('2d'); const linkCountChart = new Chart(ctx, { type: 'doughnut', data: chartData, options: { plugins: { legend: { display: true, position: 'bottom', }, } } }); }); </script>
  18. Working like a charm. Thanks @poljpocket!!!! PS: I will post my code now on the other thread so everyone can grab
  19. I want to list all pages from template=post that don't link to template=home|service.
  20. Hey :). Thanks for helping me!!! Nope. I got the links the same way. Made pie chart, list of all links with number of links pointed to them. But for some reason I can't get pages which do not link other pages (with different template).
  21. UPDATE on 15 May 2024: Google started to calculate (truncate) the meta title for 20px Arial yesterday. The Module has been updated.
  22. Oh man, and I've put it in the field description :D. I was born just a few hundred kilometers from the Tesla's house. It seems like I am Jang for his Jing.
  23. @BitPoetthanks for helping me out!!! All I can get is (normal). Just pasting part of the code: 2024-05-15 09:27:23 leftfield http://localhost/test/ Running TextformatterImgDataUri 2024-05-15 09:27:23 leftfield http://localhost/test/ Running TextformatterImgDataUri 2024-05-15 09:27:23 leftfield http://localhost/test/ Running TextformatterImgDataUri 2024-05-15 09:27:23 leftfield http://localhost/test/ Running TextformatterImgDataUri 2024-05-15 09:27:23 leftfield http://localhost/test/ Running TextformatterImgDataUri
  24. Hi @All I am checking if the post pages have no links to the service or home pages. If they don't, list them. All I can get is a list of all the post pages with links. I've tried to rewrite this function like 100 times but no luck. What am I doing wrong? // Get all relevant pages directly in one query $relevantPages = $pages->find("template=post|service|home"); $blogPosts = $relevantPages->find("template=post"); $mainPages = $relevantPages->find("template=home|service"); // Function to check if a post DOES NOT link to ANY service OR home page function postHasNoLinksToMainPages($postPage, $mainPages) { $mainPagesIds = $mainPages->explode('id'); foreach ($postPage->links() as $link) { if (in_array($link->id, $mainPagesIds)) { return false; // Found a link to a main page, so return false immediately } } return true; // No links to PUBLISHED main pages found, so return true } // echo results foreach ($blogPosts as $post) { if (postHasNoLinksToMainPages($post, $mainPages)) { echo "<tr>"; echo "<td><a href=\"{$post->url}\">{$post->title}</a></td>"; echo "<td><a href=\"{$post->editUrl}\">Edit</a></td>"; echo "</tr>"; } }
×
×
  • Create New...