Jump to content

How to post a link and treat it like facebook?


Paschalis
 Share

Recommended Posts

Hi all,

i want to have a field where i will paste only URL links from external pages. I want this to be treated like facebook:

processwire.jpg

after, when i will save it, it will be in my page as title, image, description and a target: _blank link to go in the external page where i cut it

Thank you in advance

Link to comment
Share on other sites

First, welcome to the forum.

There are many ways to accomplish goals in ProcessWire, so I'm sure others will submit additional info, or a completely different solution. :)

Probably the simplest method to start with would be to create a text field to hold the desired URL, and reference that page field in your code as the usage section describes on the github preview site.

$preview_url = new LinkPreview( $your_page->your_field );
$parsed_url = $preview_url->getParsed();

etc...

Also, that solution on that site is not the only solution available, as this functionality has been a fairly common request for a number of years. So you might want to search around for an option (e.g., jquery) that may better fit your needs.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...