Sunday, March 31, 2019
Saturday, March 30, 2019
Friday, March 29, 2019
Thursday, March 28, 2019
Wednesday, March 27, 2019
Tuesday, March 26, 2019
8 Best PHP URL Shortener Scripts
Need a URL shortener for your site, but aren't sure which PHP solution is best for you?
Like with any web development solution, there are layers of complexity to the choice. Will I be using this shortener myself? Do public users need to access it? Do I need to inject an ad, popup, or other form of content during the process?
With a shortener script in hand, you can implement a variety of solutions. Whether you're looking to make a monetized link-shortening service, track your own links throughout the web, or get more value out of sharing URLs, there's a tool for that.
When choosing a self-hosted URL shortener, all of this and more come into effect.
We've gathered some of the best PHP URL shortening scripts and tools out there, and highlighted their features to make your search easier. Whatever you're looking for in a shortener, there's likely to be something for you on this list.
Let's jump in!
1. AdLinkFly: Monetized URL Shortener
AdLinkFly: Monetized URL Shortener is not your typical URL shortener. It's a robust system designed to monetize short URLs—much like the monetized link shortening services like AdFly and ouo.io.
“Allow members to shorten links & earn money, and keep a share of the profit.”
This complete publisher and advertiser system supports several payment gateways including:
- PayPal
- Payza
- Bitcoin
- Bank Transfer
- and more
With four different API tools, admin panel, social media network login, and more, you'll be up and running your own customized URL shortener system in no time.
AdLinkFly: Monetized URL Shortener is perfect for advertisers, referral systems, and more.
2. Mighty URL Shortener
The Mighty URL Shortener short URL script offers several useful URL shortener features—and packs them into a membership-based service.
Users can choose from different plans that can be customized and pay for the link shortener service via PayPal, Bitcoin, bank transfer, and more.
Some of the features included for users:
- display website articles into redirect page
- comments system in short link pages
- advanced statistics and analytics
- social media user logins
- and more
You can also develop applications that work with the service, using the advanced API. Mighty URL Shortener is mighty indeed.
3. Premium URL Shortener
This PHP URL shortener offers some nice features and includes some CMS tools to help you build something amazing. Whether you want a public or private system, Premium URL Shortener can accommodate.
Features include:
- fully responsive template with built-in template editor
- full featured admin panel and powerful dashboard
- Facebook and Twitter user login
- geotargeting and advanced API
- jQuery with fallback
It also includes a URL bookmarking system with bookmarklets:
“URLs are automatically associated to registered users and are saved on their account for future access.”
This allows users to drag the bookmarklet tool to their browser bookmark bar, making it easy to shorten the URL of any website they view.
With full documentation and support included, the Premium URL Shortener should not be overlooked.
4. Shortny
Shortny reduces much of the bloat found in other URL shorteners and offers a straightforward, simple solution that gets the job done.
On the front-end, users can:
- create their shortened URL
- password protect the link
- copy and share the link
- see the link statistics
On the back-end side, the website admin can:
- see statistics
- delete any URLs
- edit website settings and ads
Shortny is a solid solution that provides just the right amount of features most people are looking for.
5. URL Shortener with Ads and Powerful Admin Panel
The URL Shortener with Ads and Powerful Admin Panel is another AdFly type system. When a user clicks on a link created by this URL shortener, up to two pages of ads are shown before displaying the original URL.
On the technical side, features include:
- PHP and MySql powered
- customizable template
- includes an API, LESS files and compiled CSS
Some of the user and admin features include:
- assign different admin privileges
- AdSense and analytics support
- social sharing
- search URLs
- and more
URL Shortener with Ads and Powerful Admin Panel includes just enough features to set up your own advertising link shortener.
6. Shortix URL Shortener
Shortix URL Shortener makes it easy to develop a link shortener that allows registered or anonymous users. Registered users can view graphic link stats and can optionally gain access to the shortener API, while anonymous users can simply share their newly created shortened URL.
“Shortix is a simple and beautiful script which allows to start your own URL shortening service, a web service that provides short aliases for redirection of long URLs.”
This makes it a great pick for those looking to implement a link shortening service with little setup or workarounds.
Additional features include:
- PHP mail and SMTP support
- optional shortener API
- spam protection
- AJAX interface
- and more
Shortix URL Shortener is easy to install and ready to be used for your next project.
7. URL Shortener
One of the most bare-bones solutions on this list, URL Shortener can still get the job done.
While it may not be an out-of-the-box solution for complex projects, it’s simplicity allows for easy extensibility, making it a great pick as a component of larger setups.
Features include:
- generates QR code for shortened URLs
- Google, Bing, and Yandex verification
- supports AdSense and analytics
- social share buttons
- auto copy button
- AJAX-powered
- developer API
- and more
With its powerful admin panel and easy installer, URL Shortener may be just what you're looking for.
8. URL Shortener Script with Statistics
The URL Shortener Script with Statistics packs an incredible punch for its price point. Using the Google Shortener API, this PHP URL shortener script is both good-looking and powerful.
Offers advanced link statistics from Google, such as referrals, browsers, or operating system used by the visitors.
Because it leverages Google's Shortener API, it easy to integrate this script with Google Analytics, making it perfect for those in need of tracking for a marketing or paid tracking campaign.
Additional features include:
- World Map visitors from Google Shortener API
- shortlinks with custom alias option
- clean and fully responsive design
- QR code for generated shortlink
- three AdSense \-ready spots
- and more
URL Shortener Script with Statistics is an impressive solution that delivers in both form and function.
What Kind of Shortener Do You Need?
What type of PHP URL shortener script are you looking for?
When it comes to comparing all of the tools out there, you’ll want to ask some important questions:
- Do you want to monetize your system with advertising?
- If so, do you want to use advertising redirects or simply place ads on your URL shortener website?
- What statistics are the most important to you, if any?
- Do you want to use your own API?
- What about user accounts? Or do you only want the shortener used anonymously?
- Are you looking to inject additional content onto your URLs?
Depending on your project, these questions will help you get off to a good start when researching your solution. With these answers in hand, you’ll be able to quickly tell which scripts will work for your situation, and which won’t.
Conclusion
Because there is such a wide spectrum of PHP URL shortener scripts within a limited number of solutions, it's important to completely think through what you're trying to create, and understand the problem you're trying to solve before looking for the answer.
If you can't find the solution you're looking for, you could consider making your own. On Envato Tuts+, you'll find many resources to learn PHP, like PHP tutorials and video code courses. We have beginner PHP courses, like PHP Fundamentals or more advanced video courses such as PHP Object Oriented Programming Fundamentals. No matter your learning style, you'll be sure to find helpful the right PHP code courses.
And if you're curious to know what other PHP scripts are offered, take a good look on Envato Market.
Monday, March 25, 2019
Sunday, March 24, 2019
Saturday, March 23, 2019
Friday, March 22, 2019
Thursday, March 21, 2019
Wednesday, March 20, 2019
Tuesday, March 19, 2019
Monday, March 18, 2019
How to Keep Your CSS Grid Layouts Accessible
CSS Grid makes it possible to create two-dimensional layouts by arranging elements into rows and columns. It allows you to define any aspect of your grid, from the width and height of grid tracks, to grid areas, to the size of gaps. However, CSS Grid can also lead to accessibility issues, mainly for screen reader and keyboard-only users. This guide will help you avoid those issues.
Source Order Independence
“Source order independence” is one of the biggest advantages of CSS Grid. It means you don’t have to define the layout structure in HTML anymore, which has always been the case with floats and table-based layouts. You can change the visual presentation of your HTML file using CSS Grid’s ordering and grid placement properties.
The Reordering and Accessibility section of W3C’s CSS Grid docs defines source order independence as follows:
“By combining grid layout with media queries, the author is able to use the same semantic markup, but rearrange the layout of elements independent of their source order, to achieve the desired layout in both orientations.”
With CSS Grid, you can decouple logical and visual order. Source order independence can be quite useful in many cases, however it can also seriously damage accessibility. Screen reader and keyboard users only encounter the logical order of your HTML document and don’t “see” the visual order you created with CSS Grid.
If you have a simple document this usually isn’t a problem, as the logical and visual order will most likely be the same. However, more complicated, asymmetrical, broken, or other creative layouts frequently cause problems for screen reader and keyboard-only users.
Properties That Change Visual Order
CSS Grid has a number of properties that change the visual order of a document:
order
- works with both flexbox and CSS Grid. It changes the default order of items inside a flex or grid container.- grid placement properties -
grid-row-start
,grid-row-end
,grid-column-start
,grid-column-end
. - shorthands for the aforementioned grid placement properties -
grid-row
,grid-column
, andgrid-area
(shorthand forgrid-row
andgrid-column
). grid-template-areas
- specifies the placement of named grid areas.
If you want to read more about how to use grid placement properties, have a look at our previous article on grid areas. Now, let’s see how things can go wrong with visual reordering.
Visual vs. Logical Reordering
Here is a simple Grid with a couple of links so that you can test the code for keyboard accessibility:
<div class="container"> <div class="item-1"><a href="#">Link 1</a></div> <div class="item-2"><a href="#">Link 2</a></div> <div class="item-3"><a href="#">Link 3</a></div> <div class="item-4"><a href="#">Link 4</a></div> <div class="item-5"><a href="#">Link 5</a></div> <div class="item-6"><a href="#">Link 6</a></div> </div>
Now let’s add some styles. The following CSS arranges grid items in three equal columns. Then the first item is moved to the beginning of the second row with the grid-row
property:
.container { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 0.625rem; } .item-1 { grid-row: 2; }
Below, you can see how it looks like with some additional styling for clarity. While regular users will see Link 2 first, screen readers will start with Link 1, as they follow the source order defined in the HTML code.
It will also be difficult for keyboard users to tab through the page, as tabbing will also start with Link 1, at the bottom left corner of the page (try it yourself).
The Solution
The solution is simple and elegant. Instead of changing the visual order, you need to move Link 1 down in the HTML. This way, the logical and visual order of the document will be the same.
<div class="container"> <div class="item-2"><a href="#">Link 2</a></div> <div class="item-3"><a href="#">Link 3</a></div> <div class="item-4"><a href="#">Link 4</a></div> <div class="item-1"><a href="#">Link 1</a></div> <div class="item-5"><a href="#">Link 5</a></div> <div class="item-6"><a href="#">Link 6</a></div> </div>
You won’t need to add any Grid-related properties to .item-1
in the CSS. As you don’t want to change the default source order, you only need to define the properties of the grid container.
.container { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 0.625rem; }
Take a look. Although the demo below looks the same as before, it’s now accessible. Both tabbing and screen reading will start with Link 2 and logically follow the source order.
How to Make Layouts Accessible
There are a couple of common layout patterns you can make more accessible using CSS Grid’s reordering properties. For instance, the “Holy Grail Layout” is just such a pattern. It consists of a header, a main content area, a footer, and two fixed-width sidebars: one on the left and one on the right.
Left-sidebar layouts might cause issues for screen reader users. As the left sidebar precedes the main content area in the source order, that’s what screen readers read aloud first. However, in most cases, it would be better if screen reader users could start right with the main content. This is especially true if the left sidebar contains mainly ads, blogrolls, tag clouds, or other less relevant content.
CSS Grid allows you to change the source order of your HTML document and place the main content area before the two sidebars:
<div class="container"> <header>Header</header> <main>Main content</main> <aside class="left-sidebar">Left sidebar</aside> <aside class="right-sidebar">Right sidebar</aside> <footer>Footer</footer> </div>
There are different solutions you can use to define the modified visual order with CSS Grid. Most tutorials make use of named grid areas and rearrange them with the grid-template-areas
property.
The code below is the simplest solution, as it only adds extra rules to elements where the visual order is different from the source order. CSS Grid has an excellent auto-placement feature that takes care of the rest of grid items.
.container { display: grid; grid-template-columns: 9.375rem 1fr 9.375rem; grid-gap: 0.625rem; } header, footer { grid-column: 1 / span 3; } .left-sidebar { grid-area: 2 / 1; }
So, grid-column
makes <header>
and <footer>
span across the whole screen (3 columns) and grid-area
(shorthand for grid-row
and grid-column
) fixes the place of the left sidebar. Here’s how it looks like with some extra styling:
Although the Holy Grail Layout is a fairly simple layout, you can use the same logic with more complicated layouts, too. Always think about which is the most important part of your page that screen reader users might want to access first, before the rest of your content.
When Semantics is Lost
In some cases, CSS Grid can also harm semantics; another important aspect of accessibility. As the display: grid;
layout is only inherited by the direct children of an element, children of grid items won’t be part of the grid. To save work, developers might find it a good solution to flatten layouts so that every item they want to include in the grid layout will be a direct child of the grid container. However, when a layout is artificially flattened, the semantic meaning of the document is frequently lost.
Say you want to create a gallery of items (e.g. images) in which the elements are displayed as a grid and encompassed by a header and a footer. Here’s how the semantic markup would look:
<section class="container"> <header>Header</header> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> <li>Item 5</li> <li>Item 6</li> </ul> <footer>Footer</footer> </section>
If you wanted to use CSS Grid, <section>
would be the grid container and <h1>
, <h2>
, and <ul>
would be the grid items. However, list items would be excluded from the grid, as they would be only the grandchildren of the grid container.
So, if you want to do the job quickly, it might seem a good idea to flatten the layout structure by making all items the direct children of the grid container:
<section class="container"> <header>Header</header> <div class="item">Item 1</div> <div class="item">Item 2</div> <div class="item">Item 3</div> <div class="item">Item 4</div> <div class="item">Item 5</div> <div class="item">Item 6</div> <footer>Footer</footer> </section>
Now, you can easily create the layout you want with CSS Grid:
.container { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 0.625rem; } header, footer { grid-column: 1 / span 3; }
Everything looks nice, however the document has lost its semantic meaning, so:
- screen reader users won’t know that your items are related to each other and part of the same list (most screen readers notify users about the number of list items);
- broken semantics will make it harder for search engines to understand your content;
- people accessing your content with disabled CSS (for instance, in low connectivity areas) might have issues with skimming through your page, as they’ll see only unrelated divs.
As a rule of thumb, you should never compromise semantics for aesthetics.
The Solution
As the display: subgrid;
layout is not yet implemented by browsers, you can solve the problem in two different ways.
First, you can add the display: contents;
rule to the unordered list which removes the <ul>
item from the accessibility tree. So, <li>
items will be direct children of the grid container. However, browser support of that feature is quite patchy: Edge doesn’t support it at all and other browsers also have issues with it.
The other solution is to create a nested grid by adding the following CSS rules to the unordered list:
.container { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 0.625rem; } .container > * { grid-column: 1 / span 3; } ul { display: inherit; grid-template-columns: inherit; grid-gap: inherit; }
In the demo below, you can see how the nested grid relates to the parent grid. The items are laid out as expected, however, the document still retains its semantic meaning.
Conclusion
Simple implementations of the CSS Grid layout aren’t likely to lead to accessibility issues. Problems occur when you want to change the visual order or create multi-level grids. The solution usually doesn’t take much work, so it’s always worth fixing a11y issues as you can make it much easier for assistive technology users to properly access your content.
Learn More About CSS Grid Layout and Accessibility
-
CSS Grid LayoutCSS Grid Layout: A Quick Start GuideIan Yates
-
AccessibilityBuilding an Inclusive Web: Why Accessibility MattersSami Keijonen
-
AccessibilityKeyboard Accessibility Tips Using HTML and CSSAnna Monus
-
AccessibilityHow to Use the Contrast Checker in Chrome DevToolsKezz Bracey
Sunday, March 17, 2019
Saturday, March 16, 2019
Friday, March 15, 2019
Thursday, March 14, 2019
Wednesday, March 13, 2019
Tuesday, March 12, 2019
How Learning Slide Guitar Will Improve You as a Player
Slide guitar’s most associated with blues and country music. Consequently, if these genres don’t appeal to you, learning it might seem like a waste of time.
There are also misconceptions, such as:
- You have to use an open tuning
- You must have a high action on your guitar
- You must have a guitar that’s only for slide playing
Yes, slide gets used a lot in blues and country. Yes, open tunings among slide players are popular. Yes, a dedicated guitar and a high action can make playing easier.
However, none of these are absolutes. Slide can be played in any style, in any tuning, on any guitar.
I aim to make the case that you should learn slide, because I believe it’ll improve all of your playing.
Let’s look at what slide guitar is, and why it can initially be difficult.
Slide Guitar Explained
Creating fretted notes is achieved traditionally by pressing the string down onto the required fret. As long as there’s contact between string and fret, there’s sound.
In slide guitar, a tube worn on one of your fretting fingers is used instead. Think of it as a moveable fret, touching the string on the topside rather than underneath.
Early Issues
When I first attempted slide I was horrified by the clatter of noise I produced. It took time and observation of great slide players for me to understand where I was going wrong. If you follow my suggestions, it may well save you from similar experiences.
The Right Tool
My first slide was a traditional bottleneck, which, unsurprisingly, is the neck of a glass bottle. This is great for heavy strings, a high action on your guitar and an experienced player.
However, it’s an appalling choice for beginners playing on thin strings and a low action. The strings don’t support the weight of the slide and, being close to the frets, crashing into them’s inevitable. Couple this with inexperience and disaster is guaranteed.
The choice of slide is like your pick, amp, or guitar, in that it’s totally personal.
Slides come in a variety of different materials, such as glass, ceramic and metal, as well as lengths and thicknesses. What you choose is up to you, but as a general rule of thumb, the lighter the string the lighter the slide.
I abandoned the bottleneck for a Pyrex knuckle slide. Being significantly smaller and lighter it was easier to manage on an electric guitar. I can now play most kinds of slides on lightly-strung guitars, but that’s down to a far improved technique.
Damping
Crashing into the frets aside, I was getting extraneous noise, which drowned out what I was trying to play.
Whenever I’m struggling with something, I watch players who are good at it in order to spot what they’re doing that I’m not. Or indeed, what they’re not doing that I clearly am in error.
In the case of slide, I turned to Rory Gallagher . He’d always play slide at some point in his shows, and watching him gave me the answer to my problems.
In short, playing slide is as much about removing sound as it is about creating it.
If you’re using a full-size slide, you can cover most or all the strings at once. That’s fine if you’re playing all of them, but what if you want to hear a single string? Every time you move you’ll agitate all the strings, creating unwanted noise.
The answer is damping. The fingers that aren’t being used on either hand must be employed to deaden the strings you don’t want to hear.
Damping behind the slide on your fretting hand’s particularly important. Unlike traditional fretting, notes can ring out either side of the fret. As you usually only want to hear notes forward of the slide—towards the bridge—damping has to occur. This’ll make a huge difference to the clarity of the playing.
Targeting Notes
Producing single notes, as well as transitioning from one string to another, can be tricky for slide players. Asides from the aforementioned issue of noise, the intonation has to be excellent.
When fretting notes with your fingers, each fret provides intonation—you choose the correct fret and, provided the guitar’s set up properly, out comes an in-tune note.
Playing slide is akin to playing any fretless instrument, so where it comes to rest on the string’s critical. Rather than stopping just behind the fret as you would do normally, now you must stop directly above the middle of the fret.
Doing this slowly isn’t difficult, but at speed in the middle of a song takes practice. This is why some players adopt a wide, almost drunken vibrato as it covers up imprecise intonation.
How Learning Slide Benefits Playing
If you think about what we’ve covered here, a lot of it’s applicable to all aspects of playing guitar.
Damping
Every player will benefit from tidying up the extraneous noise they create.
Intonation
Fretted instruments allow an imprecise approach, but the best results are still achieved by getting as close to the frets as you can. The precision required for slide will hone your attention to intonation.
Targeting And Transitions
Whether you’re playing slide or not, the ability to move seamlessly from note-to-note and string-to-string is highly desirable. Playing slide makes you focus on achieving that.
Broadening Your Appeal
I was at a jam night. A group of us were playing, taking turns for a solo. One guitarist was shredding away, doing his best Van Halen impression. Rather than compete, I played slide when my turn came around.
When Mr Van Halen played, only the guitarists in the room nodded their approval.
When I played slide, everyone nodded their approval. Except Mr Van Halen, who didn’t like his thunder being stolen.
Conclusion
I hope I’ve demonstrated that learning slide’s about more than just an extra skill set. I encourage you to try it, and to persevere, as it’s not easy. However, it’s worth it because:
- It’ll tidy up all of your playing
- It draws attention to your intonation
- It’ll make moving around the fretboard seem more intuitive
- The more styles you can play, the greater your appeal