Jump to content

psy

Members
  • Posts

    620
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by psy

  1. psy

    DropboxAPI

    Hi @benbyf The problem is me and github. Cant figure out how to upload the missing files. In the interim, see attached zip. DropboxAPI.zip
  2. psy

    DropboxAPI

    Think I know what's going on, starting with my limited knowledge of github. Trying to work it out...
  3. psy

    Does PW have ...

    Why isn't it WordPress?
  4. psy

    DropboxAPI

    Did you do the upgrade to DropboxAPI.module ? The original version in GitHub looked for the wrong path to the autoload.php of the SDK files. This is what it should be: require_once dirname(__FILE__) . '/dropbox-php-sdk/vendor/autoload.php'; From what I can gather from the error you mentioned, the SDK files aren't being loaded. The updated code should fix that.
  5. psy

    DropboxAPI

    @benbyf DropboxAPI.module file fixed and uploaded to GitHub. Please update your version and let me know how you get on.
  6. psy

    DropboxAPI

    Hi @benbyf Yeah, the namespace stuff did my head in too! Adding them at the top of the page template under <?php namespace ProcessWire; was the only way I could get it to work. Once they're there, and the PW module is loaded, it's a matter of following the dropbox-api-sdk documentation to the letter. Ooops! Just realised the GitHub version of the module has an error. Will upload fix.
  7. The docs say the tag is optional so it sounds right to me. Thanks @Mike Rockett
  8. Wishlist/request... would love to see on a per page/template basis a sitemap priority field. When no priority is specified, Google goes 'top page - 100%', 'sub page - 80%', 'sub-sub-page - 60%'. In reality however, the 'sub-page' is often the parent page in the menu. The 'sub-sub-page' has the guts & glory that you want indexed with a high priority. Google doesn't guarantee but says it will give a sub-sub-page with a priority eg of 80% a higher priority than it's root parent with a priority of 60%. https://www.sitemaps.org/protocol.html
  9. Maybe you need to carry var v into the function: <script> var v = new Array(); v[0] = <?=$page->video_720->url?>; v[1] = <?=$page->video_1080->url?>; function changeVid(v) { var video = document.getElementById('video'); if (screen.height <= 720) video.setAttribute("src", v[0]); else if (screen.height > 720) video.setAttribute("src", v[1]); video.load(); } changeVid(v); </script>
  10. Hi and welcome to the forums. Not sure this is the right forum for your question, but.. The same way you call the poster... ie wrap the code in php tags: The template will then render the $page->video within the javascript before outputting to the browser.
  11. Is your image field configured to one image only? if not, try $image->first->url
  12. @Roych You are only retrieving one BackgroundImages item with getRandom(). To get multiple items for your Wire Array you need to specify how many you want. https://processwire.com/api/ref/wire-array/get-random/ Alternatively to retrieve all BackgroundImages in random order you could try: <?php foreach($pages->get('/settings/')->BackgroundImages->shuffle() as $bck): ?>
  13. @billjoseph you are not alone
  14. @billjoseph I may be missing something here but why not simply modify the outer_tpl template in $options to include the Search button? Then it would always be the last item in the menu. 'outer_tpl' => '<ul>||<li><a href="#modal-example" title="Search" uk-toggle>Search</a></li></ul>',
  15. Hi @Margie I'm an Aussie ProcessWire developer. Happy to help you promote the ProcessWire cause
  16. psy

    DropboxAPI

    @benbyf Tested and confirmed you can do this. Simple example (no paging although that's possible too): <?php namespace ProcessWire; use Kunnu\Dropbox\Dropbox; use Kunnu\Dropbox\DropboxApp; use Kunnu\Dropbox\DropboxFile; $drop = $modules->get('DropboxAPI'); //Configure Dropbox Application $app = new DropboxApp($drop->app_key, $drop->app_secret, $drop->authorization_code); //Configure Dropbox service $dropbox = new Dropbox($app); $listFolderContents = $dropbox->listFolder(""); //root folder is the folder you nominated in the Dropbox App config. Refer doco $items = $listFolderContents->getItems(); ?> <ul> <?php foreach ($items as $item) : ?> <li><?=$item->getName()?></li> <?php endforeach; ?> </ul> As for download links, you could use the Dropbox Chooser https://www.dropbox.com/developers/chooser#javascript or create your own with javascript.
  17. psy

    DropboxAPI

    @benbyf Thanks Ben The token request could be on the admin side BUT the Dropbox call back URL must be a publicly viewable page to receive the token. I chose to put both the request and response on the same page and then unpublish the page once I'd received the token. According to the documentation, https://github.com/kunalvarma05/dropbox-php-sdk/wiki/Working-with-files the answer is yes. The PW module really does little more than authenticate the user and allow you to create the $dropbox object (as in example above for sending a file). Add all the appropriate "use" namespace statements in your template and you'll have full access to the API, including the ability to List Folder Contents
  18. psy

    DropboxAPI

    Tip: By default the Dropbox App is in Development mode and allows only one user - you. When you apply for a token you may get a Dropbox notification saying you need more users. Simply go back into your Dropbox App configuration and click on the button to the right of this setting. You'll automatically be granted 500 development users. Should you need more than 500 users, you'll need to apply to Dropbox for Production status for your App and totally outside the scope of this ProcessWire Dropbox API module.
  19. psy

    DropboxAPI

    Changed it to DropboxAPI
  20. psy

    DropboxAPI

    @teppo Thanks for the tip. Was a bit confused about naming conventions. The module doesn't render anything so not Markup, and to me, it was a 'process', although granted, not a PW process. Done. Let me know if there are any problems relating to the name change.
  21. psy

    DropboxAPI

    ProcessWire DropboxAPI on GitHub: https://github.com/clipmagic/DropboxAPI This module is a wrapper for Kunal Varma's Dropbox PHP SDK https://github.com/kunalvarma05/dropbox-php-sdk It was created to perform a specific function for a client, ie upload PDF files on a PW website to a specific Dropbox account folder. The PDF files, created using @Wanze's excellent PagesToPdf module using the WirePDF functions, are generated from Formbuilder forms completed by front-end site visitors. Works a treat! There's more that could be done to allow ProcessWire to take advantage of all the features of the SDK, eg downloads, multiple Dropbox accounts, etc. You are welcome to request changes and/or fork the GitHub project to extend the feature set. Enjoy! System requirements PHP 5.6.4 or greater Composer The PHP mbstring extension General information This module enables you to access a single Dropbox (www.dropbox.com) account to upload files from a ProcessWire website. All kudos to (https://github.com/kunalvarma05/dropbox-php-sdk) for the PHP API. First steps Visit (https://www.dropbox.com/developers) and read the documentation. Log into Dropbox and create a new application. It's recommended to limit ProcessWire App access to a specified folder Make a note of the App key, the App secret and the name of the Dropbox folder Installation Download the zip file into your site/modules folder then expand the zip file. Next, login to ProcessWire > go to Modules > click "Refresh". You should see a note that a new module was found. Install the DropboxAPI module. Configure the module with your App key, App secret and your Call Back URL You need to generate a Dropbox access token to enable your site to communicate with the nominated Dropbox account. Dropbox will generate a token for you or you can create a page for the front end of your ProcessWire site with a template to submit the token request to Dropbox, eg: <?php namespace ProcessWire; $drop = $modules->get('DropboxAPI'); if ($input->get->code && $input->get->state) { $code = $sanitizer->text($input->get->code); $state = $sanitizer->text($input->get->state); //Fetch the AccessToken $accessToken = $drop->getAccessToken($code, $state); echo "Copy/paste this code into the module configuration: " . $accessToken; } else { echo "<p><a href='" . $drop->getAuthURL() . "'>Log in with Dropbox</a></p>"; } ?> Once you have entered the token in the module configuration, you can unpublish this page. Usage Read the dropbox-php-sdk documentation! An example template for sending a file to a Dropbox App folder from ProcessWire: <?php namespace ProcessWire; use Kunnu\Dropbox\Dropbox; use Kunnu\Dropbox\DropboxApp; use Kunnu\Dropbox\DropboxFile; // send pdf to Dropbox $drop = $modules->get('DropboxAPI'); $app = new DropboxApp($drop->app_key, $drop->app_secret, $drop->authorization_code); if ($app) { //Configure Dropbox service $dropbox = new Dropbox($app); $dropboxFile = new DropboxFile('/path/to/myfilename.pdf'); $file = $dropbox->upload($dropboxFile, "/myfilename.pdf", ['autorename' => true]); //Uploaded File meta data if ($file) { $success = $file->getName() . " uploaded to Dropbox"; $drop->log($success); } }
  22. Hi @maxf5 Thanks for the feedback. Wow, what results. Definitely not getting those slow speeds here. Will work on reducing the images sizes.
  23. Feeling the love for ProcessWire today. Two sites launched and owners over the moon happy. Two additional sites ordered by existing clients and both specified ProcessWire as the platform. New sites: 1. https://flywithmehorses.com.au/ Owner is just starting out in business and had already spent $100's dollars and 6+ months on a 'free' website without success. She helped me so I sponsored development of her site. Client's comment: "OMGOSH this is sooo exciting!!!!!!! YAY!! Thank you alot!!!!! Can't wait to tell everyone!!! THANK YOU!!!" ProcessWire 3.0.63 2. https://cttcfilmcourse.com/ Original site built in WordPress. Over 1000 lines of code on the home page and the https://validator.w3.org/ bombed out at line 124 with "Too many errors". Google's page speed insights were cringingly bad. Project was to keep the visuals and rebuild the site in PW with a solid foundation. Job done. No validation errors and vastly improved page speed insights. Also added search and better site navigation. Client's comment: "So good!" ProcessWire 3.0.63 Looking forward to working on the next two sites, both of which will be website apps with workflows rather than informational sites. As ever, grateful for comments/feedback to improve either site.
  24. Quick workaround... in _main.php add <region id="dummy"></region> in basic-page.php add <region id="dummy"></region> Seems PW needs a region in the page template to kick-start the process.
  25. I am using regions with the tag <region id="whatever"> in the _main.php file. Config file is set up as follows: $config->useMarkupRegions = true; $config->prependTemplateFile = '_init.php'; $config->appendTemplateFile = '_main.php'; When I use a page template that changes a region, all goes well. However, I set up the _main.php file to reflect the output for a basic page. The basic-page.php template needed no customisation so was simply as follows: <?php namespace ProcessWire; ?> When a page with the basic-page template was output, all the <region> tags remained in the HTML, ie were not stripped. When I added a customised region to the basic-page.php template, all the <region> tags were stripped from the output _main.php HTML. Did I do something wrong or is this a bug? Using ProcessWire 3.0.63 © 2017
×
×
  • Create New...