Jump to content

applab

Members
  • Posts

    36
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Nottingham, UK

Recent Profile Visitors

2,201 profile views

applab's Achievements

Jr. Member

Jr. Member (3/6)

18

Reputation

1

Community Answers

  1. @Matzn although the OP didn't specify, I'm assuming that the included content is coming from the same domain and therefore it's not a cross-origin problem, @Liam88 let us know if that's not the case. @Matzn's #5 suggestion is worth a try, you can use either <object> or <embed> instead of <iframe> but you can't populate it using a literal chunk of HTML, which is what I assume you're getting from `<?=$page->landing_page_html?>'`, you'll need to provide a URL that returns the content, so something like... <div> <embed type="text/html" src="<?= $pages->get('/landing-page/')->url ?>" width="600" height="400" /> </div> or <div> <object type="text/html" data="<?= $pages->get('/landing-page/')->url ?>" width="600" height="400"></object> </div>
  2. In my experience 403's are usually the result of the hosts WAF (Web Application Firewall) being triggered (<iframe>'s are notorious for this). Contact your hosts support, give them the URL that's causing the 403 and ask them to check their WAF logs for a violation. It's not unlikely that they will add an exception for you, otherwise you'll need a re-think!
  3. Ok, so I decided to scratch my own itch on this one... I need to handle WebP's which include transparent regions so I've created a modified version of the @Robin S module (https://processwire.com/modules/webp-to-jpg/) but which allows you to choose between PNG or JPEG as the target format. https://gitlab.com/applab/pw-uploadwebp
  4. Has thinking around this issue changed at all? Support for .webp as an upload format for images would be a game-changer for my current project (and has been requested by several previous clients).
  5. Thank you very much, that has got me up & running :-) Thanks to your tip I've also realised that I can check 'Modules Loaded' in my Tracy debug bar if I encounter a similar situation again. Cheers, Martin.
  6. Hi, I've installed the module FieldtypeComments and now I want to add comments via the API as shown here https://processwire.com/talk/topic/357-creating-comments-via-api/ But I'm getting a 'class not found' error on this line $c = new Comment(); I have no problem creating pages with `new Page();` but I'm unable to create a comment with `new Comment()` Can anyone point me in the right direction? Thanks, Martin.
  7. Hi @bernhard, sorry for the delayed response but I'm flitting between 2 projects and have just come back to this. From looking at that Tracy source code and reading the Tracy docs it looks like the method used relies on the alt-template being in the main /site/templates/ folder and having a recognisable suffix. My goal is: 1) to keep dev templates outside of the main templates folder (eg. have /site/templates/ and /site/dev-templates/) 2) for /site/dev-templates/ not to require a full set of templates, just one or two that are being worked on, and to 'fallback' to the main templates folder if there is no tpl for the current request in dev-templates. My problem is that include files and assets are no longer in the same relative location if the alt-template is used when the dev-tpl is not in the same folder as the main tpl. TBH, it's not super-high priority but I think it would be useful both when collaborating or when modifying a live site so I will come back to it at some point.
  8. Hi @monollonom Doing it this way still encounters the problem I had with my original method, ie. it finds the alternate template but require/include files aren't found as relative paths are now different. I'm not sure how I'm going to approach that, I will give it some thought over the weekend. BTW, because I have an extra level of folders I had to modify your code slightly to append a / after the username. $userTpl = str_replace("templates/", "templates-dev/" . $event->user->name . '/', $tpl->filename); Thanks for giving it some thought :-)
  9. Thanks @monollonom, though as per @androbey's suggestion the conditional is not necessary if the username matches the folder name and can be used directly to construct a path. On a side note, I wasn't aware that fieldTemplates was a thing until I saw your post so I've learned something very useful :-)
  10. This is exactly how I usually approach it. In this case though I was hoping to achieve a setup where each dev's folder does not need to contain a full set of template files, just the one or two they are working on, and for any template not found in the dev's folder it will fallback to the main template directory, ie. the same way Wordpress child themes work.
  11. Thanks @androbey, I hadn't seen that post but I have used render() plenty of times, I might end up going that way. I've sort of got it working but I had to put my dev templates in the main template folder (with a different name) otherwise all my include paths are wrong. I was hoping to keep them separate.
  12. Hi, I'm trying to change a template file at runtime based on the logged in users name. in addition to the /site/templates/ folder I have a /site/templates-dev/ folder, and under that is a folder for each developer. so, if I'm logged in as `timmy` and a file exists at `/site/templates-dev/timmy/article.php` then that file should be used, otherwise use `/site/templates/article.php`. in /site/ready.php I have $fp = $config->path('site') . 'templates-dev/' . $user->name . '/' . $page->template . '.php'; if(file_exists($fp)) { //echo "found tpl!"; $page->template->filename($fp); } If I uncomment the `echo` statement then I can see that it's finding the alternate template but if I view the page it's just blank (status 200, 'this request has no response data available'). Is anyone able to point me in the right direction please? Thanks, Martin.
  13. Thanks @kongondo, that is precisely the info I needed. Next time I'll RTFM a bit more before I post!
  14. Hi @Zeka, Yes, I am using $modules->get("MyModule") in my front-end template. I was just surprised to see MyModule get installed as a result of that code rather than throwing an error, which is what I was expecting. I've achieved my original goal of preventing the install in that situation but I've realised that I still need to use isInstalled() in my front-end templates to avoid runtime errors so, thanks.
  15. Hi All, I'm making my first serious foray into module development and I've discovered some behaviour which I found surprising... If I uninstall my module from the backend but do not delete the file, then I refresh a front-end page that is using that module, I would expect to see some kind of error but what happens is the module gets automatically re-installed. I can mitigate this behaviour by wrapping my front-end code in: if(modules()->isInstalled('MyModule')) { ... } but that doesn't seem like the best approach if the module is used in multiple places. Is there something I can add to my modules install() method to prevent it getting auto-installed in this situation? Thanks.
×
×
  • Create New...