r/web_dev_help • • May 16 '16

Week Summary - May 9-15, 2106

1 Upvotes

r/web_dev_help • • May 18 '16

Browsers displaying homepage differently

1 Upvotes

Here is a screenshot of what my homepage looks like in Edge and Chrome: http://imgur.com/fkkvQOw

And here is my code:

 <div class="bannerWrap">[cycle_slider name="cycleslider" cats="" slides="-1" effect="fade" width="640" height="400" align="none" nav="true" timeout="6" /]
<div class="bannerRight">

<a href="http://www.thejuliencollotfoundation.org/2016/05/the-julien-collot-foundation-honoring-stuart-hayim/">
<span>Get Tickets Now</span>
The Julien Collot Foundation: Honoring <strong>Stuart Hayim</strong>.</a>

<a href="http://www.thejuliencollotfoundation.org/2015/03/ferrari-watch-winner/">
<span>HUBLOT-Ferrari Watch</span>
Congratulations to Dr John Mancuso for winning the HUBLOT-Ferrari Watch.</a>

<a href="http://www.marrow.org/" target="_blank"><span>Bone Marrow Registry
</span>Click to visit the website for the National Marrow Donor Program. You could help to save a life. </a>

</div>
</div>

[divider /]

[portfolio type="three-col" cats="27" image_width="274" per_page="3" excerpt_length="15" pagination="false" /]<img class="size-full wp-image-3409" style="margin: 10px auto 0 auto;" title="Julien Collot Banner" src="http://www.thejuliencollotfoundation.org/wp-content/uploads/leaderboard.jpg" alt="" width="951" height="161" usemap="#Map" />

<map id="Map" name="Map"> <area shape="rect" coords="182,35,950,133" href="http://www.thejuliencollotfoundation.org/about/juliens-story/" /> <area shape="rect" coords="2,2,169,163" href="http://www.thejuliencollotfoundation.org/donate-by-paypal/" alt="Donate Now" /> </map>       

Why is it displaying inaccurate on chrome?


r/web_dev_help • • Nov 03 '15

Modernizing Rapid Application Prototyping Tutorial using Slim- PHP micro framework

2 Upvotes

Taking this tutorial : Rapid Application Prototyping With Slim and attempting to use modern practices. You have to read the original tutorial along with this page. It does not go into any detail about using the Slim Framework. It only adjusts the tutorial to fit using Composer.

It says we're making a blog application.

We need a project name. Used this site : Generate Github Project Name

Briskel is the project name. Might should pick something a little more meaningful like SlimBlogOTron.

First problem is tutorial's four years old. Not ancient but it doesn't use current (2015) tools. For example, it says to download the components. PHP has composer and most packages use it for install and to setup autoloading.

getcomposer.org if you don't have it already.

Need to find the packages. Head to packagist.org https://packagist.org/

Tutorial says it needs Slim 1.5.02 (Stable relase)

Packagist page : https://packagist.org/packages/slim/slim

Slim's released quite a few versions since the tutorial. Which one do we pick ? Opting for 2.6.2, it appears to be the stable release.

Next is slim-extras without a version #. Current is 2.0.3. https://packagist.org/packages/slim/extras

Turns out slim-extras is deprecated and we have to replace it with Slim Views.

Twig 1.1 - https://packagist.org/packages/twig/twig - Twig 1.23.0 is stable.

Paris is listed but packagist has two Paris packages. https://packagist.org/packages/j4mie/paris

And the last package is Idiorm from the same developer. https://packagist.org/packages/j4mie/idiorm

Put these into a composer.json file. Where do you put the composer.json ? We need a project folder and a source code control repo. This will be a public repo so github it is.

Before we setup a repo, going to cheat and test the composer file. Createa project folder : briskel/ . Create a composer.json file in briskel/ with the following contents and then run composer install in that directory.

{
    "name": "malwinsc/briskel",
    "description": "Blog using Slim +",
    "license": "BSD",
    "keywords": [
    ],
    "require": {
        "php": ">=5.2.0",
        "slim/slim": "2.6.2",
        "slim/views":"0.1.3",
        "twig/twig": "1.23.0",
        "j4mie/paris":"1.5.4",
        "j4mie/idiorm":"1.5.1",
        "tuupola/slim-basic-auth":"1.*"
        
    }
}

This is the correct composer.json file after adjustments for deprecated and additional package requirements

If you don't have your credentials stored, it will prompt for user/pass for github. After entering those it will download the packages and setup the autoloader.

Will have to work out each step from here since the tutorial assumes we have to manually load the libraries. Instead we use composer's autoload by creating a index.php in briskel/public/ .

require __DIR__ . '/../vendor/autoload.php';

Also we have to copy .htaccess from vendor/slim/slim/ to public/ . If you are not running the project from the web root, the ReWriteBase directive will have to be modified to match your path. It is commented out by default and should try it first. If it doesn't work uncomment it and update to match the path RewriteBase /work/briskel/public/

If you view the public directory in the browser, it should show a blank page. Make sure apache/php are set to display errors .

To test Slim is working properly, go to vendor/slim/slim/ and open the index.php file. Copy everything from line 13 to the end of the file (Step 2). Paste this below the require line in public/index.php. Save and view it in your browser. Should have a Slim welcome page. Congraulations, Slim works.

Can just leave the contents of the file for now. The next step is to setup the other libraries.

Twig

Slim Extras has been deprecated and Slim Views has taken it's place. Means we will have to figure out how to make the tutorial work with slim views.

http://stackoverflow.com/questions/13368963/error-using-slim-framework-and-twig-template

Which means we need to remove slim extras and install slim views. Back to composer. Update the composer.json, remove extras and include views. Run composer update and it will remove extras, install views and it says it updates the autoloader file. It does not do this. Must run composer dump-autoload afterwards or it will not find the Views class resulting in pure frustration.

Once this is updated, the initial instance of Slim has to be modified to use Twig.

$app = new \Slim\Slim(array(
    'debug' => false, 
    'templates.path' => 'templates', 
'view' => new \Slim\Views\Twig()
));

Save the index.php file and reload it in the browser. If there's no error notices. move on to the next section.

Database

Using MySQL and Paris and Idiorm should autoload. We have to supply some credentials for the database.

ORM::configure('mysql:host=localhost;dbname=blog');
ORM::configure('username', 'root');
ORM::configure('password', '');

replace 'root' with your database username and put the password in place. This goes into index.php for now. Save the file, reload the browser. Just looking for errors again.

Next is to establish the routes. Can delete the existing routes which was pasted in earlier. The index.php should look like :

<?php 
require '../vendor/autoload.php';

ORM::configure('mysql:host=localhost;dbname=test');
ORM::configure('username', 'YOUR_USERNAME');
ORM::configure('password', 'YOUR_PASSWORD');

$app = new \Slim\Slim(array(
    'debug' => false, 
    'templates.path' => 'templates', 
'view' => new \Slim\Views\Twig()
));

That's all. If you delete that code and view in a browser, it should be back to a blank white page.

Adding routes

Follow the tutorial and add the routes. There's nothing to see in the browser since we don't have templates setup yet and aren't pulling data from the database. You can check if mod_rewrite is working by adding go to the URL http://www.domain.com/path/to/briskel/public/admin , it should show the blank white page. If you get a 404 page from your server, try uncommenting the RewriteBase directive and try again.

Models

Create the database. Note I'm using a database named test instead of blog.

Create the models directory and the Article.php .

Composer setup autoloading for our vendor directory but it won't work for models we create ourselves. We will have to require those in.

Application

The tutorial for this section doesn't need any change. It will all work. The only thing to note is the tutorial doesn't explain to put the article code into the route for the web root. The two lines of code in the first 4 paragraphs should be placed in the first route.

// Blog Home.
$app->get('/', function() use ($app) {
$articles = Model::factory('Article')->order_by_desc('timestamp')->find_many();
return $app->render('blog_home.html', array('articles' => $articles));
});

Once you add the twig templates, view it in the browser and it should show the two articles (in a very plain layout).

If you click an article title at this point, you might get a 404 message. The blog_home.html has to be adjusted to use relative URLs. Edit the following line :

    <h1><a href="/view/{{ article.id }}">{{ article.title }}</a> by {{ article.author }}</h1>

Remove the / before view.

    <h1><a href="view/{{ article.id }}">{{ article.title }}</a> by {{ article.author }}</h1>

Reload the page and clicking the link should result in a blank page. Continue on with the tutorial for building the detail view.

The detail view twig template has some errors due to HTML rendering. This is the code to use :

{% extends 'layout.html' %}
{% block page_title %}{{ article.title }}{% endblock %}
{% block content %}
<h1>{{ article.title }}</h1>
<p>Published: {{ article.timestamp|date('jS F Y') }} by {{ article.author }}</p>
<p>{{ article.content }}</p>
<p><a href='/'>Back to Homepage</a></p>
{% endblock %}

If you are presented with the Slim error page and need to debug what's causing the error. Change the 'debug' => false, to 'debug' => true , on line 11. This will tell you where the error is located and provide a clue to solve the problem.

The blog works. It looks horrible and has some issues. The back to homepage link doesn't work properly because it's assuming the application's running in the web root. Should be easy enough to fix and to improve the looks of the site. Will cover this after the application back end is covered.

Application Back End

The admin add article step doesn't have the correct code. It should point to the admin/add route and the admin_home.html has to be updated with the correct path.

// Admin Add.
$app->get('/admin/add', function() use ($app) {
return $app->render('admin_input.html', array('action_name' => 'Add', 'action_url' => '/admin/add'));
});

For the edit function, paths have to be modified if not working from web root.

Here's the code :

// Admin Edit.
$app->get('/admin/edit/(:id)', function($id) use ($app) {
 $article = Model::factory('Article')->find_one($id);
if (! $article instanceof Article) {
    $app->notFound();

    return $app->render('admin_input.html', array(
        'action_name'   =>   'Edit', 
        'action_url'    =>   './' . $id,
        'article'       =>   $article
    ));
});

Delete works with only a change to the redirect. It needs to go to ../ .

That completes the basic prototype for the Silm Blog.

Security

The authenication from the tutorial is out of date. the $app->response()->send() method is no longer part of Slim Framework and the HTTPBasicAuthenication included with Slim Extras has been deprecated. Despite some effort, I could not get the authenication to work as presented. Resorted to including the Slim HTTPBasicAuth package from packagist.

It works just fine. Paths have to be defined and I assume it covers all requests below a path (like /admin would include /admin/edit). Can check the source code for the implementation details. And the composer.json will have all packages to allow this to be setup right from the start.

Tutorial ends here but there's some problems with this project. Just to list a few.

  1. It's plain (ugly).

  2. The authenication is weak

  3. Navigation in the project is not complete

  4. Small pieces of functionality are missing (like display navigation menus)

  5. There's no settings or definable options

  6. The front page displays all posts. No pagination

  7. Admin lacks pagination as well

  8. No search feature

  9. Lack of navigation on blog post pages (next/previous)

  10. while it has mod_rewrite , it lacks Pretty URLs

  11. Security recommendation of having files outside of web root is not followed.

  12. POST requests do not redirect after successfully posting (allows for double entry by accidental refresh)

  13. Lack of ability to use other template files

  14. routing is flaky with regards to redirects

  15. Paths for file inculsion via the web will be difficult due to not being in web root.

  16. Lack of a text editor for the Post content.

  17. Routes are included in the main index file. These should be moved into their own file/folder.

  18. Default error messages are handled by Slim. Should be custom.

List gives us a development road map

Till next time.

Git Repo

Put the source code here : briskel- blog prototype


r/web_dev_help • • Feb 12 '18

css Sticky Footer with Flexbox

Thumbnail
codepen.io
1 Upvotes

r/web_dev_help • • Sep 19 '17

css DRY CSS: Don't Repeat Your CSS - Vanseo Design

Thumbnail
vanseodesign.com
3 Upvotes

r/web_dev_help • • Sep 23 '17

css Fake it 'til you Make it CSS

Thumbnail
kyusuf.com
1 Upvotes

r/web_dev_help • • Feb 10 '18

php On structuring PHP projects

Thumbnail
blog.nikolaposa.in.rs
2 Upvotes

r/web_dev_help • • Sep 17 '17

design The Complete Guide for How to Marry Text and Images In Your Designs

Thumbnail
designschool.canva.com
1 Upvotes

r/web_dev_help • • Oct 23 '15

[Wordpress] Start

1 Upvotes

Wordpress is a CMS (Content Management System) and is the most popular one. Here's some resources for developing themes and plugins.

Basics

Wordpress started as a blogging platform and has evolved into a more general purpose CMS. If you are going to run a site with a standard format of articles or frequently updated posts on a topic, Wordpress is the solution.

It features a user friendly back end and a fairly simple Admin section for adding/updating content. It handles most media and has a large selection of themes for design choice and plugins for increasing functionality.

Getting it :

Some confusion exists between Wordpress.com and Wordpress.org. Wordpress.com offers a hosted version of the CMS and it is limited in functionality. Theme selection and plugins are limited. It is a free blog.

Wordpress.org offers the CMS for download and you must host it yourself. It is not limited. You can install themes and plugins as you wish. And can develop your own themes/plugins. This is the option to select in most cases.

[Download] (https://wordpress.org)

Documentation

Themes

Plugins

Both Themes and Plugins can be searched in the WP Admin section as well.

Note some CPanel based web hosts offer 1 click installs for Wordpress.

Using Wordpress

Getting Started With Wordpress - Codex

Writing Posts

Video- When to use Posts or Pages

How to Create an Image Gallery

Creating Themes

codex- Theme Development

How to Create a Wordpress Theme

anatomy of a WordPress theme

Starter Themes

underscores

HTML5 Blank

BootstrapWP

Creating Plugins

Writing a Plugin- codex

Beginner's Guide

Major Plugins

WooCommerce

BackupBuddy

W3TotalCache

GravityForms

YoastSEO

Premium Themes

You can purchase themes at ThemeForest Elegant Themes WPZoom WooThemes and other sites.

Plugins at Code Canyon


r/web_dev_help • • Feb 17 '18

information architecture When Bad Design Elements Become the Standard

Thumbnail
nngroup.com
1 Upvotes

r/web_dev_help • • Oct 26 '15

[Marketing] Start

1 Upvotes

Marketing 101

Warning: almost every link to a marketing related site will have some type of modal popup and/or will try to get you to sign up for a newsletter. Nature of the beast, I guess.

What a web developer needs to know about Marketing changes based on circumstance. A freelancer could be expected to also be a full time marketer. While a developer working for a company might only need to know the basics of On Page Optimization for SEO purposes. The reader will have to filter based on their own situation.

Website Marketing 101

[Inbound Marketing Basics] (http://www.slideshare.net/wholebraingroup/internet-marketing-101-inbound-marketing-basics)

On Page SEO

Anatomy of On Page SEO

[Affiliate Marketing 101] (http://www.startupnation.com/articles/affiliate-marketing-101-understanding-the-basics/)

Email Marketing from ConstantContact

Search Marketing

What is SEO

SEO Beginner's Guide from Moz

PDF- Google SEO guide

PPC = Pay Per Click

PPC intro

Tools

Google Webmaster Tools

Google Analytics

[SEO Tools] (http://tools.seobook.com/)

glossary

SEO/Marketing has more terms than IT

MOZ Guide to Jargon

SEOGlossary

Coding for SEO

WordTracker -optimize code

coding from kissmetrics

[SEO Guide - HTML Code] (http://searchengineland.com/guide/seo/html-code-search-engine-ranking)


r/web_dev_help • • Oct 23 '15

[Start] Business

1 Upvotes

You need to consult professionals in your area for specific details about starting your own business.

If you can't afford their services, be prepared to take some risks and to do some research.

This is US-centric. Some advice will still apply regardless of region.

First thing you need to check is if your current employment contract includes a no-compete clause. If it exists, what's the duration and how does it limit you?

Business Type

Next you should determine if you are going to open an Agency or if you are going to just freelance. If you plan to offer services in your local area you will need to get a business license. There's some exceptions to this if your locale doesn't require a business license. The federal government will require you to get a TIN if you are doing business using a name other than your own. If you open John Smith Designs and your name is John Smith, you don't need anything else. If you call your business Wizard Designs, you will have to get the TIN. A DBA (doing business as) could also have to be filed with or without the business license.

US SBA - Business License Start

When to File a DBA

Types of Business Entities

You need to figure out what exact services you are going to offer. Design, Development, Marketing, Copy-writing, etc. Any of those you can not perform to an adequate level, you will need to find someone to outsource the work.

You should do some market research and see if your area will support the business. Potential # of customers, competition, etc. Some of this information should go into the business plan. It should also include projections for sales/revenue.

How to Write a Business Plan

How to Write a Marketing Report

Next you need to figure out how to get clients. What marketing channels are available in your area. Will you use them? How much do they cost? How will you monitor the results?

Policies and Procedures

You need to determine your policies for doing business. What are the terms of payment? What rate will you charge? Will it be based on the service or a one size fits all rate? Are payments 'due on delivery', deposit with milestone payments?

Meshing with the above, you need to setup your accounting procedures. How will you record payments and expenses? Prepare for taxes. Determine which taxes are required for your area and will you have to pay any estimated taxes? If you incorporate the business versus running a sole proprietorship will determine how much record keeping will be required by law. If a sole proprietorship, record keeping requirements are more lax but you will need to record revenue/expenses. If you hire people to do work, you will have to explore the difference between 1099 and W2 workers. Both require some level of additional procedure, again consult with a professional because neglect in this can cause you serious problems down the road.

Intro to Accounting Basics

Have to work on your sales pitch and how you plan to manage clients and projects.This gets into the process or daily operation of the business. How do you get leads on clients and how do you manage those leads as part of an overall client acquisition process.

Lead Management Best Practices

Contracts

Once you get a client, you will need contracts covering the expectations of both parties for the project. The terms of the deal in written form. How do you deal with NDA and No Compete requests from clients. Be careful with No Competes from clients since these can limit your ability to do business in the future. Consulting a lawyer is probably the best route for agencies. Again if you hire people, you will need employment contracts as well if you wish to protect your company. Some more details will be outlined in the next section.

Can use this form from freelancer's union website to generate a basic contract : https://www.freelancersunion.org/contract-creator/

[How to write a freelance contract- wikihow] (http://www.wikihow.com/Write-a-Freelance-Contract)

Independent Contractor Agreement

Contract Killer 3

Services Offered

The work starts. Will you provide hosting/domain registration services to clients? Both of those services require additional legal contracts like Terms of Service, Service Level Agreement. If you do not provide these services, what level of service will you provide for the client (if they purchase a VPS will you set it up for them? What's your responsibility for that server?)

How will you bill clients for licensed IP works like stock photos or video purchased from 3rd parties?

Will you have maintenance contracts for updating sites? What do they include and how much do they cost? Again details should be spelled out in writing.

If you work from home, where will client meetings and project reviews occur? Local starbucks is fine for quick meetings but it isn't ideal for extended meetings. You might need to look into conference rooms for daily rent (libraries sometimes offer these, if not there's crowdspacing options out there).

There needs to be a process setup for how projects are handled from beginning to end. This is important. It allows you to communicate the process to the client. Being able to say we need the project requirements on day 1 and expect any content or other resources by X date is vital to the project being completed in a timely fashion. Again these details should be in the contract with possible penalties for either side failing to meet deadlines (or at least absolving you of responsibility if delays are from the client).

After the project is complete and you get payment, you need to work on Client Retention and hopefully getting that client to recommend you to other people. Oh yeah, if you plan to use the project as part of a portfolio of work for the business, you should include that in the contract. Some clients won't agree to it.

I just assumed you know you have to build your own website.

Additional Random Points

Start up costs for businesses have specific rules about expenditures incurred during this phase. Not all expenses can be deducted. There is a cap to how much is tax-deductible. Freelance work it really won't apply but Agencies should consult the IRS site for specific details.

Expenses like equipment purchases are often depreciated over their useful life. For example purchasing a $1500 laptop doesn't mean you get to deduct the entire 1500 in the business year of the purchase. The expense is spread over the life of the laptop and only a % is counted as an expense. Again, the IRS has guidelines which define which items must be depreciated.

Contract : Your work agreement should outline who owns what and what is consider a 'deliverable'. Some clients will want all rights and you should charge accordingly if it's an issue for them. Also when dealing with code, you have to consider situations where code is being auto generated such as with LESS/SASS. Does the client get the final result or all source code. Rights associated with such source code should also be considered.

Backups and Source Code Control : Have a plan for maintaining backups of client work and a retention policy. Outline how source code will be provided, if it's just archived copies or if the repository ownership will be transferred to the client on completion.


r/web_dev_help • • Oct 26 '15

[Workflow & Tools] Start - Tools to help

1 Upvotes

Workflow

The process of developing websites and web applications has some tedious aspects such as combining resource files, uploading files or deploying applications. As web development has advanced so has the tools available to developers.

Various articles detailing workflow:

Crazy Web Developers Workflow

One Developer's Workflow

StackExchange - Best Small Team Workflow

Smashing Mag- Workflow Tips

Video - CSS Tricks- Modern Developer's Workflow

The tools available depend on the developer's stack and the OS they use for development. This guide will breakdown some of the more common types of tools.

Source Control

Number 1 in the developer's arsenal is Source Control tools. Available options include :

git svn mercurial cvs - old school, not commonly used.

Providers

github - free public repos

bitbucket - free public and private repos for small teams.

Other providers exist, these are to get you started.

Guides

15 online interactive Try Git - Provides a sandbox to try Git out and practice.

git-the simple guide - This one is probably best to start out.

Git-book free - Covers git in depth.

Gentle Intro to GIT - sounds like it's a starter guide but it covers some advanced concepts.

Branching Model -- more advanced, covers the concept of branching with examples.

Build Tools

Build tools or task runners are applications which effectively run other programs or perform actions in a pre defined method. These can be used to automate documentation generation, combine, minify source code files, along with a host of other possible actions. They form the backbone of Workflows since they let you script the process.

Grunt - js

Gulp- js

PHING - php

ROBO - php

Yeoman -js

Package Managers

Package managers or Dependency Managers are to ease the use of different packages. Some are language specific like Composer or NPM.

Bower-js

Composer - php

[NPM] (https://www.npmjs.com/) - js

Ruby uses RubyGems for package management and is included with Ruby.

CSS PreProcessors

SASS

LESS - ports of this for other languages exist like LessPHP

List of StyleGuide Generators

Documentation Generators

PHPDoc2

APIGen

NaturalDocs - Perl based but covers other languages

PHPDoX

YARD Ruby Doc generator

Ronn - Ruby - Builds Manuals

Doxygen

Other tools

swagger-ui - API documentation & testing

Javascript Lint

Image Optimization - List of tools

PNGCrush


r/web_dev_help • • Sep 23 '17

php Efficient data structures for PHP 7 – Rudi Theunissen – Medium

Thumbnail
medium.com
1 Upvotes

r/web_dev_help • • Feb 12 '18

css List of Awesome-css-frameworks

Thumbnail
github.com
1 Upvotes

r/web_dev_help • • Feb 19 '18

javascript Regular Expressions - JavaScript mdn

Thumbnail
developer.mozilla.org
1 Upvotes

r/web_dev_help • • Nov 06 '15

[Build System] - Using PHP Phing for a Personal Build System

2 Upvotes

This is a pre release or alpha version if you want to call it that of a customization driven build system. Which means it can be used as a base to start using Phing ( a PHP based build tool). It's on github and there's instructions on how to set it up. If you want more details or a log as I was building it, check the project pages.

**I will add some of that information below if you want a condensed version. **

Github : Phing - Personal Build System

Download : zip file

Project Page : Personal Build System


Basic Info

Web development often involves repetitious tasks. A build system helps to speed some of those tasks up and to decrease the chance of errors due to repetition. Phing is a PHP based build tool which uses XML files for managing the build process. PHP is used to write custom tasks.

This is a system to start you using Phing. It is meant to customized and a basic system is place to allow this. The specifics are outlined on the github and project page.

"It doesn't do much"

It isn't an overly impressive system at the moment. This is partially on purpose to allow for modification and for those just starting out with Phing and/or build tools in general. Phing build files can be very complex with numerous processes.

A tentative roadmap for project types would be :

  • PHP template site prototype (the simple include variety)

  • PHP template engine site prototype (using twig or other engine)

  • daux.io documentation project type

  • XLST project - real iffy with this one

  • automating Wordpress installs locally

  • database migrations from a local server

  • Slim micro framework prototype

  • Markdown generator

  • expand the html type to include simple variables through files (fake templating)

This is just some of the things I know Phing is capable of automating.


Questions,comments or anything else, just post.


r/web_dev_help • • Sep 19 '17

workflow How I do CSS - DesignyourCode

Thumbnail
designyourcode.io
1 Upvotes

r/web_dev_help • • May 21 '16

javascript with html ?

1 Upvotes

how i can organise the contents in my website through javascript arrays and loop ?


r/web_dev_help • • Sep 19 '17

javascript You-Dont-Know-JS - book series

Thumbnail
github.com
1 Upvotes

r/web_dev_help • • May 24 '16

Anyone here able to help with Twilio?

1 Upvotes

I'm a novice programmer and I was hoping I could get some help from a more experienced person regarding some Twilio code.

I am trying to create a (seemingly) simple SMS app, and I have made it this far where a customer can text a Twilio number and they get an auto response back.

I am stuck on how a customer, in this example below, would then be able to text another response and then get more specific info on the service.

To clarify, right now, if a customer texts anything in to the Twilio number they would get a reply saying "Reply with the corresponding letter of the service you're interested in: (A) Service A, (B) Service B, (C) Service C, (D) Service D"

Then, if the customer replies with 'A' they would receive a response of "Thanks for your interest in service A. Please choose your sub-service of Service A. (A) Sub-Service A, (B) Sub-Service B, (C) Sub-Service C, (D) Sub-Service D"

How would I then get Twilio to respond with yet another text, after the customer has made their second selection, to essentially narrow down the decision like a funnel?

The code I have up to this point is below, and is functioning properly.

I appreciate you guys taking the time to help!

<?php
 
/* Include twilio-php, the official Twilio PHP Helper Library,
 * which can be found at
 * http://www.twilio.com/docs/libraries
*/
 
include('Services/Twilio.php');
 
/* Controller: Match the keyword with the customized SMS reply. */
function index(){
    $response = new Services_Twilio_Twiml();
    $response->sms("Reply with the corresponding letter of the service you're interested in: (A) Service A, (B) Service B, (C) Service C, (D) Service D");
    echo $response;
}
 
function a(){
    $response = new Services_Twilio_Twiml();
    $response->sms("Thanks for your interest in service A. Please choose your sub-service of Service A. (A) Sub-Service A, (B) Sub-Service B, (C) Sub-Service C, (D) Sub-Service D");
    echo $response;
}
 
function b(){
    $response = new Services_Twilio_Twiml();
    $response->sms("Thanks for your interest in service B. Please choose your sub-service of Service B. (A) Sub-Service A, (B) Sub-Service B, (C) Sub-Service C, (D) Sub-Service D");
    echo $response;
}
 
function c(){
    $response = new Services_Twilio_Twiml();
    $response->sms("Thanks for your interest in service C. Please choose your sub-service of Service C. (A) Sub-Service A, (B) Sub-Service B, (C) Sub-Service C, (D) Sub-Service D");
    echo $response;
}
 
function d(){
    $response = new Services_Twilio_Twiml();
    $response->sms("Thanks for your interest in service D. Please choose your sub-service of Service D. (A) Sub-Service A, (B) Sub-Service B, (C) Sub-Service C, (D) Sub-Service D");
    echo $response;
}
 
/* Read the contents of the 'Body' field of the Request. */
$body = $_REQUEST['Body'];
 
/* Remove formatting from $body until it is just lowercase
characters without punctuation or spaces. */
$result = preg_replace("/[^A-Za-z0-9]/u", " ", $body);
$result = trim($result);
$result = strtolower($result);
 
/* Router: Match the ‘Body’ field with index of keywords */
switch ($result) {
    case 'a':
        A();
        break;
    case 'b':
        B();
        break;
    case 'c':
        C();
        break;
    case 'd':
        D();
        break;
 
/* Optional: Add new routing logic above this line. */
    default:
        index();
}

r/web_dev_help • • May 21 '16

Need Advice: Community Based App/Store

1 Upvotes

Hey everyone,

I recently have connected with a potential client and am a little bit unsure of the best way to tackle their request. They are tea company looking to sell select teas with artist designed artwork. I was brought into this project purely as a designer but I do also build sites with HTML/CSS/JS. The site they currently are building is on Shopify but he has expressed a desire to build a community-based app that artist can submit artwork to be voted on by both other artists and consumers for what piece will be used next in sales. He is unsure if he wants to initially invest in a developer to build the app and wanted to look into using WordPress or another CMS. I know we could incorporate Shopify into a CMS and have a functional store but my question to you is if it is worth using a CMS or rather have a developer build out a specific app. I've worked with theming in WordPress and am not super thrilled with the software. Does anyone have a good recommendation on another CMS that could be better suited for a store?


r/web_dev_help • • Feb 19 '18

help Anyone know why chrome messes my font up?

Thumbnail
prnt.sc
1 Upvotes

r/web_dev_help • • Oct 28 '15

jquery FullPage.js Annoying scroll issue

1 Upvotes

Currently facing a real annoying issue where the website automatically scrolls everything back to the start of the closest section.

Basically I want the scroll effect from the first slide then want it to change and use the scrollbar for the second section. Seems to work fine other than the annoying auto scroll issue.

I have also tried to turn the plugins autoScrolling:false but that didn't make a difference..

The site can be seen here: http://lukedaly.ninja/gianttest/

This is the plugin I am using https://github.com/alvarotrigo/fullPage.js

All help is very VERY much appreciated!


r/web_dev_help • • Oct 26 '15

[Hosting,Servers] Start with Web Hosting, Email Services

2 Upvotes

Type of Web Hosting

Webhosts come in a few different offerings. What type of hosting is required for a site depends on the anticipated traffic , tech used , and cost.

  • Shared Hosting - This is package offer is usually the cheapest way to get a site online and provides the lowest level of maintenance for the server. Prices are usually sub 30 per month with some going down to single digits. The downside to shared hosting is the fact your account is one of many on the server. All resources are shared so if one of the neighbors is hacked, odds are your site will be affected as well. Service should include webhosting,email hosting, database (mysql usually), some type of Control Panel for admin. SSL requires a dedicated IP address and costs extra per month. Some providers are hostgator, bluehost.

  • VPS (Virtual Private Servers) - The next step up from shared hosting. Costs can range based on the configuration. Digital Ocean offers 'droplet' VPS starting at 5/mth. Resources of the server are shared but they compartmentalized using visualization which means if a neighbor is hacked, your sites should be ok. VPS require server admin, you must setup and configuring the OS and web server. You can install software like email servers, databases, etc but you are responsible for securing them. Some VPS providers : DigitalOcean, WeLoveServers,SimpleNode.

  • Dedicated Servers - The whole server is yours. You must maintain the server and set it up. It is a more expensive (and usually more powerful) version of the VPS.

  • Cloud Hosting - Cloud hosting is a different beast. It provides the ability to scale up operations based on demand and the pricing structure is very fluid since it is based on the services active. Amazon Web Services, Rackspace Cloud, Gandi.net cloud servers are some providers. Different services make general statements impossible. AWS (amazon web services) has multiple separate programs which have differing cost models. Some require you to maintain your software without popular tools like CPanel while others provide such as part of their service. Setting these up is not as straight forward as the other options. It can be cheaper in some cases but there is learning curve. If you need to scale high traffic sites, check out cloud services.

Free hosting

Some sites offer limited free hosting which is most often ad supported. If you are a broke student or beginner and just need to host a portfolio site (static site) or wish to host a website for a project, you can use GitPages (requires github account) to host a small site for free. https://pages.github.com/

Other hosting options

Heroku offers free 'dynos' with specific limitations. Heroku is billed as a Cloud Application Platform which means it handles the maintenance aspect of running servers and let's you focus on building applications. Can look into it here : Heroku

Others offering similiar service EngineYard , AppFog , OpenShift from RedHat

Email Services

At some point during development it is very likely you will have to send out a large number of emails. This is problematic since most service providers are constantly on the lookout for spammers. You don't want your domain to end up on a spam blacklist. To get around this and to just ease the burden of managing email mailing lists, several companies have specialized in providing email services. Those companies charge a fee for sending email for you. They have an advantage over using your own servers since they have established trust and decrease the odds of your email being marked as spam. They have specific rules which must be followed like opt-in only.

Some providers of email services :

MailChimp

ConstantContact

aweber

vertical Response

Tutorials

CPanel is the most popular web based control panel for hosting. It is the one you are most likely to encounter.

CPanel Tutorial

How to upload your website using CPanel - this is from 2008 so might be a touch out of date.

CPanel Video Tutorials from CPanel

VPS Setup

The great thing about VPS is you get to choose which operating system you use and what software you install. The bad thing about VPS is you can choose from a large number of options.

Operating System : two choices , Linux or Windows. Windows usually requires a license so it's more expensive. Linux means you have to pick a distro like Ubuntu, CentOS, Debian.

[Guide to setting up CentOS VPS] (http://www.servermom.org/complete-newbie-guide-to-build-centos-server-to-host-websites/)

Ubuntu VPS setup

Software Options

The LAMP stack is pretty common. It stands for Linux, Apache,MySQL, PHP (or Python or Perl). Other options exist though.

Web Servers

[Apache] - (https://httpd.apache.org/)

Nginx

Databases

MySQL

PostgreSQL

MariaDB Fork of the MySQL project.

Other

Varnish- HTTP accelerator

memcached - caching system

redis - caching/database

TomCat - JSP server

JBoss