Giter VIP home page Giter VIP logo

link_preview's Introduction

Link Preview

Offers a field that will place a link to the frontend in the publish pages

SPECS

Using the brackets syntax, it permits to create frontend links related to the entry.

REQUIREMENTS

  • Symphony CMS version 2.3.4 and up (as of the day of the last release of this extension)

INSTALLATION

  • git clone / download and unpack the tarball file
  • Put into the extension directory
  • Enable/install just like any other extension

You can also install it using the extension downloader.

For more information, see http://getsymphony.com/learn/tasks/view/install-an-extension/

HOW TO USE

  • Add a Link Preview field to your section.
  • Set up the url format using values from other fields.
  • Use "Anchor Label" to give your link a custom label.
  • A simple link will be added next to the title of the entry.

HOW TO SET UP THE URL FORMAT

  • Use {$fieldname} to include the handle of a field
  • Use {$fieldname:value} to include the value instead of the handle
  • Use {$fieldname:id} to include the ID of an associated entry
  • Use qualifiers for php date_format to format date and datetime fields:
    • i.e. /article/{$date:Y}/{$date:m}/{$date:d}/{$title}/
  • Use qualifiers for php date_format to format the current system date:
    • i.e. /today/{$system:date:Y}/{$system:date:m}/{$system:date:d}/
  • Available system values:
    • system:id => Entry ID
    • system:time => 'H:i'
    • system:date => 'Y-m-d'
    • system:day => 'd'
    • system:month => 'm',
    • system:year => 'Y',
    • system:root => URL,
    • system:workspace => URL . '/workspace',
    • system:http-host => HTTP_HOST,

LICENSE

MIT http://deuxhuithuit.mit-license.org

Voila !

Come say hi! -> https://deuxhuithuit.com/

link_preview's People

Contributors

nitriques avatar twiro avatar chobohub avatar beaubbe avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar Pascal Piché avatar  avatar Alex Leduc avatar

link_preview's Issues

No access to site parameters?

As a rule I always use the /data/params/root ($root) parameter to preface URLs - as quite often the project will be worked on within several domains (localhost, test and production) - however I've tried a couple of things and don't seem to be able to get these parameters to work. Is this a limitation?

Proposal: Configurable "Anchor Label" instead of hardcoded term "Preview"

It would be great if the term "Preview" used for the link-label on the publish-pages wasn't hardcoded but configurable just as the label that's used in the entries tables.

I like the way the "Entry URL Field" manages this and think the separation between "label" (used for the entries-table-header) and "anchor label (used for the links in the table and the header-link on the publish-entry-pages) would be of benefit here too.

Thinking a step further an additional "Use URL instead of anchor label in entries table"-option would be the perfect complementary feature to that, as I actually liked the initial behavior (Pre-PR#1) to show the full URL in the entries table.

Does not work with "Number Field"

This extensions uses the field_id to fetch values from a field (https://github.com/DeuxHuitHuit/link_preview/blob/master/fields/field.link_preview.php#L251):

$fieldValues = $entryData[intval($field->get('field_id'))];

Number Field does not return a field_idvia $section->fetchFields();, so it does not work with this extension.

If I simply use id instead of field_idin this line everything works as expected:

$fieldValues = $entryData[intval($field->get('id'))];

I bet there's a reason for using field_id instead of id in this context, but I have no idea what it might be :) If field_id is the way to go I'd simply post an issues at the "number field"-extension.

But if you'd say one is as good as the other I might simply update my 1.2-PR to use id.

Checking for id if nothing was found with field_id might be an appropriate compromise too - what do you think?

No link in entry view

Hi,
I'm coming back to this one #7.

There is no link in entry view for authors with Manager and Author user types. Reason is extension is trying to append link to #context .actions (which is an <ul> element) that is available only for Developers.

My workaround is to append ul.actions every time when it's not present. Like this
if ($('#context .actions').length == 0) $('#context').append('<ul class="actions"></ul>');

Hope I'm not messing up anything...
Regards,
Shin

Access entry ID

Is there a way to access the ID of an entry for building the URL?
I tried $id, $entry-id and $system-id, but none of them seems to work.
If another identifier is used it would be great if you could give a hint in the documentation.

If it's not possible yet it would be a great update to this extension.

Variables prefixed with "system:" don't work

The call to the system data array doesn't work because every "system:xyz"-variable is stripped down to simply "system" before it's used as a key in the SystemData-array.

This can fixed by rebuilding the full key that way:

    // if nothing was found, revert to SYSTEM_DATA
    if (strlen($value) < 1) {
        $value = $sysData[$variable.':'.$qualifier];
    }

But it feels a little hacky because $variable and $qualifier have to be used in wrong context...

Should I try to come up with a cleaner fix for this that also considers the entry ID (in your prefered way) or do you want to fix this yourself?

And just out if curiosity - wherefore do you use these system dates? As the preview links are generated "live" including the current date/time will result in links that change from time to time - or am I getting this wrong?

Preview button shown only when entry exists

Trying this extension for the first time.

Proposal
The preview link button could be shown in page context only when the entry already exists, e.g. is edited and not being created. Otherwise it's just a broken link?

Not sure how to do it the nice way, I have tried to do it by checking for a /new/ presence in window url path.

Field doesn't display in entry

The link appears in the section table, but not in the entry. Looking at the source it appears that something is where it should be, but nothing displays.

This is in a 2.5 build (but I have a feeling I flagged the same issue for 2.4, but no idea where, maybe I just thought about it)

Page Select Box

This extension is great and I'm sure will help a lot of our clients when updating their website.

However I'm not sure how to get this working for pages where I use the 'page select box' extension.

I have a section titled 'page text' that controls the content of each page, with the page select box field to determine which page on the site the text is assigned to.

I add the link preview field and in the URL Format I enter the handle of the page select box field, which works great. But when I have a page that has a parent the parent isn't brought into the URL format as this is not in the page select box field value.

Does anyone know if it would be possible to edit the code for this to work with the page select box and multi-level page navigation?

Many thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.