Jump to content

Ibai

Members
  • Posts

    327
  • Joined

  • Last visited

 Content Type 

Downloads

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Development Blog

Deprecation Tracker

Providers Directory

Forums

Events

Store

Gallery

Posts posted by Ibai

  1. 11 hours ago, Eudemon said:

    just few point of improvement base on your code

    you can just have one of this, this pushes all adsbygoogle globally

    
    (adsbygoogle = window.adsbygoogle || []).push({});

    you can also store `article:eq(0)` to a variable then select whatever within it, so you don't have to repeat the same code, you can also shorten all the statements above with one line tenant condition

    Hey Eudemon,

    Thanks for your tips. Yeah, definitely the code was optimizable, that was the first approach. I applied your second suggestion.

    However, are you sure that one line of push is enough? I've been testing and when I code just one line of push, it shows only the last ad. I put back that line for each ad and now is showing all of them.

     

    Thanks for your support!

  2. Thanks for the idea @Eudemon

    This is my final code for long articles, which I inserted in a advertisement block and then I load wherever I want with {advertisement="myad"}

     

    <script>
      const yoyo = '<ins class="adsbygoogle"........ADSENSE INS TAG.......></ins>';
      window.addEventListener('load', function () {
        if($("article:eq(0) p").size()>10){
          $("article:eq(0) p:eq(8)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
        if($("article:eq(0) p").size()>25){
          $("article:eq(0) p:eq(20)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
        if($("article:eq(0) p").size()>50){
          $("article:eq(0) p:eq(43)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
        if($("article:eq(0) p").size()>75){
          $("article:eq(0) p:eq(69)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
        if($("article:eq(0) p").size()>100){
          $("article:eq(0) p:eq(98)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
        if($("article:eq(0) p").size()>130){
          $("article:eq(0) p:eq(128)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
        if($("article:eq(0) p").size()>170){
          $("article:eq(0) p:eq(167)").after(yoyo);
          (adsbygoogle = window.adsbygoogle || []).push({});
        }
      });
    </script>

     

  3. 11 hours ago, Nathan Explosion said:

    Or I may be wrong? Taken a look at it a little closer this morning and it has the following comment:

    
    * Text for use with data-ipsTruncate

    So maybe it's not used the way I indicated. Try it, see if it makes a difference.

    Definitely didn't work hehe.

    I think IPS should develop sth. If you have a list of 20 LONG articles, the webpage load is very heavy and suboptimal. Potentially would make it worse in SEO terms. The browser has to wait until the whole page is downloaded and then execute the javascript to perform the lines cut.

    Anyhow, thanks for the workaround!

  4. 9 hours ago, Nathan Explosion said:

    Take a look at the optional $length parameter that truncated() has, which defaults to 500 when not specified....

    
    {$record->truncated(false,700)|raw}

    The false is the default value of the $oneLine parameter for truncated()

    Wow thanks!

    Then if 500 is the default length for truncated, why is not truncating my content and instead it shows the full content? Maybe this is a bug?

    Cheers,

    Ibai

  5. Hey,

    Just if somebody was in the same point as me. This is the code that I'm currently using.

    The template is in Category Articles -> entry. Find:

    {record->truncated()|raw}

    Replace with:

    {{$real_truncated_text=substr($record->truncated(),0,700);}}{$real_truncated_text|raw}

    Warning! This is working for me and for my structure with a sidebar. If you are not using a sidebar, maybe you have to increment the 700 to your desired chars number.

  6. 4 hours ago, opentype said:

    Yes. If you just cut off the content field, you can cut off HTML tags and brake the page. But you can shorten the truncated text. 

    I know it's possible to break HTML code. However, I guess, the "truncate()" function already "simplifies" the HTML that is being shown, there's no HTML special tags. In fact, there's only <br>s.

    I mean, wouldn't it be a good idea to cut the text to 500 chars even if it's more that what's going to be shown? Just as a matter of optimization. If you post contents of thousands of chars, all of them are sent to the response.

    Thanks for the advice and idea, I'm going to apply it to my forum 🙂 

  7. Hey there,

    I'm using Pages as a blog with 1 column design. 

    When something is working slow (internet, server, client browser...), during the load of the web, the full article text is shown. Finally, when the webpage finishes loading, some javascript is run and the content of each article is truncated to N lines.

    What fires this truncation is this attributes in the section HTML tag: data-ipsTruncate data-ipsTruncate-size='7 lines'

    First question: Why is this being cut in the client and not in the backend? That makes the HTML heavier, CLS issues and so on.

    Is there any workaround? 

    Then, I see this function which cleans the HTML {$record->truncated()|raw}, but does not cut the text. Is it possible to cut the text in there?

    Cheers,

    Ibai

  8. Hey!

    Previousloy with IPS <4.5, when a user was adding images to a post, they weren't enabling lightbox feature unless the image was bigger than the post box dimensions.

    Now in 4.5, the lightbox is always binding to any image even if the image is just a button such as this, let my try here:

    logo_dark.png

    As you can see, the Invision logo is smaller than the post size, so I think it does not make sense to enable the lightbox system.

    This is a simple example, my users build posts with lots of images in a icon basis way, so it's very unconfortable to load the lightbox feature to them.

    Is there a way to lock this feature with small images?

     

  9. I loved this plugin and it's a pity all of this.

    Installed last version and I sth is not working fine. First the plugin was not saving my settings, then I unistalled and installed back again and most of the settings are saving fine (some of them not). However, the footer is not being displayed in my forum 😞 

  10. 4 hours ago, bfarber said:

    It's far easier for us to advise if we can get in and see your configuration. That said, the legacy handler is never "automatically" used. It was set during a 3.x upgrade in the file storage handler configuration, and if the /screenshots folder (in your case) is web accessible, it should not be necessary. You should be able to edit the storage handler and adjust the "Custom URL" option to remove the PHP loader.

    Fine! That's the case, web accesible yeah.

    I've searching in the ACP and I don't find any setting for that custom url. Could you tell me where is it exactly? I've looked into Advanced Configuration, under Data Storage tab

    image.png.68ab2b5c8a211c509338f92049e8dc8c.png

  11. 17 hours ago, bfarber said:

    This means your file storage handler is configured to use the legacy loader (which was necessary when moving to 4.x from 3.x if you were storing the screenshots outside of your web root directory).

    If those files are now web accessible, you can adjust the file storage handler custom URL option approriately.

    Hey bfarber!

    I think it might be a bug. I saw that in the past I had stored the files under /uploads and then I moved to /screenshots. When I moved back to uploads, the files were moved back to the uploads folder and the URLs came back to the static resource. However, it's not working with the widget "top downloaded files".

    Anyhow, you see... only setting up the screenshots folder to the original one "solved" partially the issue.

    Should I place a ticket? Or is this something I missed in settings? Where to I change the storage handler you mention?

  12. Hey there,

    Sorry for bother you again with this topic... I'm a bit lost and I don't know if this is something that you guys can help me to solve or if I need to place a ticket for this.

    The point is that my Files system is loading all images using somehow IPS's legacy proxy image. All the image URLs are like this:

    https://www.fmsite.net/applications/downloads/interface/legacy/screenshot.php?path=/monthly_2021_01/fmsite-fm21-real-name-fix-corregir-licencias.thumb.jpg.363b3512baedc1704ccac072b07b112d.jpg

    That's not good for SEO as it's not able to cache as an static image resource.

    All the images in my site are stored just as the Files screenshots system. In fact, they may be loaded statically just like this: https://www.fmsite.net/screenshots/monthly_2021_01/fmsite-fm21-real-name-fix-corregir-licencias.thumb.jpg.363b3512baedc1704ccac072b07b112d.jpg

    Can you help me to fix this? Why the system is loading the image that way?

    I've been searching and reached to this template bit: core->global->thumbImag. It is converting the URL using the legacy screenshot link.

    The issue is in this line:

    {{$image = ( $image instanceof \IPS\File ) ? (string) $image->url : $image;}}

    Cheers,

    Ibai

  13. 1 minute ago, Charles said:

    I would suggest using AWS S3 storage in that case. It's designed for storage and very CDN friendly.

    Hey Charls, thanks for your reply.

    I don't get the point of storing files in s3 in this case. I don't have any issue storing them in my server just like I do with articles attachments and images.

    The thing is that when I use those File's widgets, instead of pointing to the resource directly, the core->global->thumbImage template bit is converting the URL using the legacy screenshot link.

    The issue is in this line:

    {{$image = ( $image instanceof \IPS\File ) ? (string) $image->url : $image;}}

    Which I am able to comment. Then, the widget uses the real and direct link to the resource. However, those links returns error 500.

    Any ideas?

  14. On 6/27/2018 at 4:05 PM, bfarber said:

    You did not specify these were multiple-GB files. I also would not store those in the database, indeed.

    You can store files outside of the web root directory if you write a PHP script as a gateway. Look at /applications/downloads/interface/legacy/screenshot.php and /applications/gallery/interface/legacy/image.php. These are present because 3.x allowed you to store files outside of the web root directory, and upon upgrade we do not move the files to a new location (so a gateway script is necessary to read and print those files out). You just have to enter a custom URL into the file storage handler "http://mysite.com/applications/downloads/interface/legacy/screenshot.php?path=" and then the actual path of the file gets appended to the URL (at which point it is passed as a query string parameter to screenshot.php which does the rest).

    In short, this is largely already possible, although I can't say if it's something we want to push to the forefront and make a common feature.

    Sorry for the bump of a such an old topic @bfarber

    Is there a way of avoid using this legacy screenshot loading? I store all my files in my server accessible from outside. Both latest files and most downloaded files are loading their images with this legacy system.

    The bad point of this is that the browser cannot cache the images.

    This is not happening with article's images, for instance.

    Cheers,

    Ibai

  15. 10 hours ago, theipsguy said:

    Thanks, that's great to know!

    Presumably the admin cp lazy loading setting has to be enabled for the loading="lazy" code to work?

    We are in an odd situation where we actually don't want lazy loading for forum attachments, but would like it in other areas like profile pictures. 

    You don't need to enable that setting in ACP. It's enough changing the template bits adding the loading="lazy" property 🙂 

  16. Hey!

    I was wondering if is it possible (and if it's not, is it planned?) to paginate in Pages records. Simple question, just that.

    For long texts, usually is better to paginate. In addition, Google doesn't like very long articles. Isn't it?

    Cheers!

  17. 3 hours ago, Morrigan said:

    Because Forums only have two fields. "Title" and "Content" and you can fill in the rest when you copy. Unfortunately there is no surefire way to go from one custom field to another. IPS wouldn't know which ones to copy where and you'd get all sorts of out of alignment content.

    Hmmm I guess every database record (or most) has a title and description inputs. Same as a thread Copy does, it could copy just the title and text and then leave the rest of the inputs empty. 🤔

×
×
  • Create New...