How to finish your MVP in a weekend.

You’ve got an idea, you’ve done your research and now you must validate your idea by building an MVP.

Here are some ideas and tips to ensure you get that MVP wrapped-up in a weekend:

  • Don’t be concerned about using the latest library or framework, use PHP and JQuery if it means you get the job done quicker.
  • Don’t even think about future scalability, no AWS auto-scaling. Opt for the free plan from Cloudflare for your CDN.
  • Don’t waste time setting up a pipeline to minify your JS and CSS, just check the boxes in the Cloudflare dashboard and they’ll minify everything for you.
  • Don’t spend time setting up HTTPS, or ensuring you redirect from HTTP to HTTPS. Again it’s just a Cloudflare checkbox.
  • Don’t charge anything for your MVP, give it away for free. Don’t setup Stripe or any other payment system.
  • Don’t spend time on design or a logo, use a free landing page template and consider using an emoji for your logo.
  • When registering your domain name, use a provider like Gandi which provides whois privacy for free.
  • Don’t register or setup any social media profiles.
  • Do setup Google Analytics (or similar), its quick and will help you validate your idea.

Finally, launch as quickly as possible and start spreading the word on HN and PH, if you have created something people want and are willing to pay for, then give yourself permission to improve your MVP and do some of the things above. If not, discard it, or pivot. Good luck!

Here’s a successful MVP that I’ve built in a weekend using the methods above:

How to set PHP memory limit and max execution time in your Dockerfile

If you want to set the PHP memory limit and/or max execution time to something other than the default, you can do this in your container during build. Use following in your Dockerfile:

The RUN commands above will copy the default production ini file, and then will modify the memory_limit and set it to 4 gigabytes in the ini file. It also sets the max_execution_time to zero, meaning there is no max.

Modify Search API sort order in Drupal using a hook

If you need to change the sort order of the Drupal 7 Search API using code, here is an example using hook_search_api_query_alter:

 

How to use a relative path to your JS and CSS in Drupal 7

By default, Drupal uses an absolute path, and will insert your domain name into the path to your JS and CSS files.

You can override this, in template.php, like so:

 

Drupal: How to use the Context Module to include javascript on specific pages

I needed a solution which allowed me to include Optimizely’s A/B testing snippet on certain pages, and have the ability to change those page rules without modifying code.

I do this using the Context module, I apply a class to the body for a node with the path “demo”, like so:

Then, in html.tpl.php, in the <head> of my document, I have the following code:

Images in Drupal RSS Feed, without additional modules

There is an easier way to include the image associated with your node in a Drupal Views RSS feed. No additional modules are required.

Firstly you need to add the Media RSS namespace to your views-view-rss.tpl.php:

Secondly, in the row style template for your RSS feed (mine is called views-view-row-rss–market-news-rss-feed–feed.tpl.php), you need add a media element, and enter your image field name, your image style, and your dimensions:

Lastly, make the field data available to the template above by adding the following to your template.php

Thanks to these guys for the inspiration:

Drupal: How to access fields in html.tpl.php

When developing my AMP subtheme for Drupal 7, I wanted to only include the amp-youtube extension if the current page actually contained a YouTube video. The amp-youtube extension javascript can only be included in the HEAD of the HTML document, so in Drupal, your html.tpl.php must know about content which is usually only available at node.tpl.php level. Here is the solution:

In your template.php

in your html.tpl.php

 

Curata and Drupal Integration

So you want to integrate Curata with your Drupal site? Here’s how:

  1. Install BlogAPI, and Services modules
  2. Enable the above modules, and also “MetaWeblog Provider” and “Old Blogger Provider” for Blog API, and the Services, “Services XMLRPC Server”.
  3. Under Home » Administration » Structure » Services create a new endpoint of type XMLRPC, both name and endpoint URL should be “curata”.
  4. Under the resources tab of your newly created service, check all boxes under “blogger” and “metaWeblog” sections.
  5. At this point you might want to create a new content type for articles published from Curata, it should only contain title, body, image* fields. Having fields other than these, which are required fields, is a problem because will be left blank and therefore prevent Curata from being able to publish. I created a content type called “Curata Article” and referenced it in the step below.
  6. Next you need to create a Role within Drupal, the only permissions it requires are “Manage content with BlogAPI”, “Administer content”, “Curata Article: Create new content”, “Curata Article: Edit any content”, “Curata Article: Delete any content”. Now create a user with this role assigned.
  7. In Home » Administration » Configuration » Web services  » BlogAPI, set the default provider to “Blogger” and select the content type you will allow Curata to publish to, probably the “Curata Article” content type you created in step 5.
  8. Now you’re ready to hook up Curata. Login and go to CCS. Under the share menu, click on CMS then “Add CMS channel”.
  9. Enter your Drupal website URL, the “discover” feature will fail because, unlike WordPress, XMLRPC is not advertised to the world.
  10. Enter your endpoint URL, should be https://www.example.com/curata and provide the credentials for the user account you created in step 6.
  11. Click the authenticate button and Curata will connect and get a list of Content Types it can publish to, as defined in step 7.
  12. The rest of the Curata settings are down to your personal preference. Save all changes and then share some of your approved content from within CCS, ensure it appears in Drupal and you’re all set.

* I have not been able to get Curata to publish images directing into Drupal. To get around this you can edit your “Post Body” field in the Article Display settings within Curata. Here is my post body template:

 

Running Acquia DevDesktop under a different user account

So I recently found, due to corporate IT policy, my local admin/elevated privileges had been removed, and therefore I was unable to run Acquia Dev Desktop.

After having corporate IT support enter their administrative credentials, i found my local Drupal site was displaying the “Install Drupal” screen, rather than my local website. This screen is usually displayed when the local database is empty, but after checking my PHPMyAdmin, i could see this was not the case.

Maybe the new username account used to launch Dev Desktop didnt have permission to access the database, or could even see it? Correct, here’s my solution:

I copied this file:

C:\Users\My_Username\.acquia\DevDesktop\DrupalSettings\loc_[sitename]_dd.inc

…to the folder for the new user who has permission to launch DevDesktop:

C:\Users\New_User\.acquia\DevDesktop\DrupalSettings\loc_[sitename]_dd.inc

(The above folder was previously empty)

And, BOOM, now the local Drupal site runs successfully.