Jump to content

Macrura

PW-Moderators
  • Posts

    2,766
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. The technique i described above would not be blocked unless the adblockers decided specifically to block your server. Otherwise this would operate just like any other content on the page that is generated or manipulated by JS.
  2. You can serve any content from a PW install by creating placeholders on the target page, then use javascript to populate those placeholders. Here's one way, though there are probably many - i did this once and it worked pretty well: The JS would load it's html from the remote server. In the template that will display the content, you would put something like this at the top: $request_headers = apache_request_headers(); $http_origin = $request_headers['Origin']; $allowed_http_origins = array( "www.example.com" ); if (in_array($http_origin, $allowed_http_origins)){ header("Access-Control-Allow-Origin: " . $http_origin); } if(!$input->pid) exit("no page id specified"); if($input->pid) { // Sanitize the request $pageRequest = $sanitizer->int($input->pid); // Look for the page $banner = $pages->get($pageRequest); if(!$banner->id) exit("banner not found"); // echo your banner here exit(); } on the target site custom.js: var baseUrl = "http://www.example.com/services/banners/"; // the location of your custom js file: var script = $("script[src*='scripts/custom.js']"); var pageID = $(script).data('page-id'); if( typeof pageID != 'undefined' ) { $( "div#p"+pageID ).html('<p>Loading...</p>'); $.get( baseUrl + "?pid=" + pageID, function( data ) { $( "div#p"+pageID ).html( data ); }); } and on the page that will display the banner: <script data-page-id="1020" src="scripts/custom.js" type="text/javascript"></script> <div id="p1034"></div>
  3. this could be a good field to hold site settings when your users need to be able to keep defining/adding settings.
  4. ok right, well my technique uses 2 redirects, but does guarantee that every page on the site gets redirected to it's new counterpart without having to do anything extra.
  5. Feature request: one thing that would be cool is to be able to enable this only for some templates, instead of disable; because i only need it on the contact page, so i'd need to disable like 30 templates, rather than enable 1, the way it is currently; Is there any way of conditionally loading this module by the API? One of the really critical issues here is that the module is still not able to skip stuff like twitter handle (e.g. @processwire)
  6. yeah, tis true; i guess my results apply more for front end, and assumes you are caching the page..
  7. in my datatables testing, my results were that the fastest render were if you have the data in a js object on the page; this way there is no 2nd request for the ajax; and no parsing of the table markup, since it is all pure JS.
  8. where are those - on the old domain?
  9. you would need something like this in your old site's root folder htaccess RewriteEngine On RewriteCond %{HTTP_HOST} www.thepaleofix.com.com [NC] RewriteRule ^(.*)$ http://www.dranthonygustin.com/$1 [L,R=301] Once the URLs are all forwarding from the old domain, you would then use a combination of htaccess 301, and Jumplinks (module) to handle the differences. because with the above rules if someone requests http://www.thepaleofix.com/resource/purepharma-m3-review/ they will definitely be redirected to http://www.dranthonygustin.com/resource/purepharma-m3-review/ so then your local 301 or Jumplink would do the 2nd 301 to the new page
  10. yeah the DrewM has been rock solid - use it in all kinds of places (hooks on form builder, ajax subscribe forms etc.) example
  11. kuhl, the die antwood stuff is freaking hilarious, i couldn't work to this, would be too listening...
  12. last couple of days The Shadows (Greatest Hits etc.) Misc classic jazz Steve Reich (Music for 18 Musicians etc) Gurdjieff/De Hartmann Piano music Scott Walker (film score and instrumental selections)
  13. the wireRenderFile() function won't have access to your custom variables, you would need to do this: $viewBag = array( 'content' => $content, 'summary => '$summary, ); then echo wireRenderFile($page->template->name .'.inc', $viewBag);
  14. ok here is a sample function that i'm using to init selectize on a table field: $(function(){ $('li.Inputfield_table_field tr').each(function(){ var selOpts = new Array(); // add stuff to JS your array here... $(this).find('input[name*="_icon_select"]').selectize({ delimiter: ' ', persist: false, maxItems: 1, options: selOpts, }); }); }); so for example, you would need to be using AdminCustomFiles module and then this would be inside the ProcessPageEdit.js
  15. right, sorry about that, i need to put in a >5.4 in the requirements because i'm using the fancy array notation which will 500 on earlier than 5.4 So in other words, this module doesn't particularly need to be on 5.4 (could change the code), but on the other hand <5.4 is considered EOL and insecure i think; You may run into other modules that also have a > 5.4 requirement If you feel that this module should support 5.3 let me know and i will update it
  16. I'm guessing php version, i will probably need to either change the code to make it work for earlier PHP versions; all of my hosting is now > 5.4. What php version are you on?
  17. It is definitely managed by OG tags - if you have the correct meta then FB will use your specified OG image, otherwise it will search for and use the first image. here is an example <meta property='og:title' content='###' /> <meta property='og:type' content='website' /> <meta property='og:site_name' content='###' /> <meta property='og:locale' content='en_US' /> <meta property='og:url' content='http://www.website.com/' /> <meta property='og:description' content='###' /> <meta property='og:image' content='http://www.website.com/site/assets/files/####/image.1200x630.jpg' /> <meta property='og:image:url' content='http://www.website.com/site/assets/files/####/image.1200x630.jpg' /> <meta property='og:image:type' content='jpg' /> <meta property='og:image:width' content='1200' /> <meta property='og:image:height' content='630' />
  18. Maybe consider using a javascript select such as Selectize.js; you could init those fields and let selectize get the options from a custom js array... that's probably the only way to make an icon select in a column of table without actually making it a page select or options; Plus you could actually show the icon when using a select and store the class as the value; when rendering i don't think you'd need bother with hanna code, you could just output the icon.
  19. ok fixed - hopefully this example can work for your scenario...
  20. you have to find the repeater events for the month, so you first have to apply a runtime property to each repeater event for the the month... $newsletterrepeater = $thispage->newsletterrepeater; $months = array(); foreach($newsletterrepeater as $n) { $months[] = date("m",$n->getUnformatted("newsletterdate")); $n->month = date("m", $n->getUnformatted("newsletterdate")); } $months = array_unique($months); rsort($months); foreach($months as $m) { $monthName = date('F', mktime(0, 0, 0, $m, 10)); $monthNews = $newsletterrepeater->find("month=$m"); echo '<table><tr><th colspan="3">'.$monthName.'</th></tr>'; foreach ($monthNews as $archivenews) { echo '<tr><td>'.$archivenews->newsletterdate.'</td>'; echo '<td>'.$archivenews->newslettertitle.'</td>'; echo '<td><a href="'.$archivenews->newsletterlink->url.'">View File</a></td>'; } }
  21. you can group by months by creating an array of all the used months: $months = array(); foreach ($newsletterrepeater as $item) { $months[]= date("m", $item->getUnformatted("date")); } $months = array_unique($months); rsort($months); to get your month name you can do something like this: $dateObj = DateTime::createFromFormat('!m', $month); $monthName = $dateObj->format('F'); but you probably need to do 2 loops where you do the years first and then the months within the years..
  22. that is really cool - hopefully others find it useful also; i was able to create a 'restricted' role with that permission, and add it to selected superadmins on the project, and now they have a much smaller, restricted set of tracy items – working great! thanks as always!
  23. right - ok thanks, sure - yes, a per-superuser permission is best, to limit the panels, or none at all (sorry for being dense, doing like 10 things at once here..)
  24. When i posted that, i hadn't registered that you made the user bar; I haven't used the module config for this enough to be able to give a coherent answer about the panels but will study and return with more comments.. Hopefully i set this up right – i created a new permission called tracy-debugger-superuser, then i created a new role called 'developer' and then added that permission to that role; so now only people with the developer role should be able to see the tracy debug bar (?)
×
×
  • Create New...