0

While viewing an entry in the control panel, can I generate a link that would open it in my public website? That is, display a link like "www.mysite.com/articles/{url_title}"?

Using EE3, but can update to 5 if needed.

1

If I understand the question, then except under very specific circumstances the answer is probably 'no'. The reason goes to the heart of how EE works. EE separates the storing of data from the generation of HTML output to your website - data is stored as entries in channels, but there is no strict association between these channels and what appears on your site: indeed EE is rich in elements that allow you to build templates that output pages that are built from complex association of the data drawn from multiple channels and multiple channel entries.

Accordingly when you are looking at an entry in EE CP, there is no particular reason to think that that entry will itself generate a page of output - so the idea that you can have a link that will display the output is not always so meaningful. Further, given this separation of design, output and content, it is usually not possible to tell from a single entry where it will be output by the site - indeed one entry may appear on multiple pages.

The only exceptions to this are as follows:

  • You have designed your site to map single entries to single pages, either by manually building a set of site templates that does this, or using a commercial add-on such as Structure that basically simulates the style of site construction you would see in Wordpress;
  • Your entry contributes to just one page in the site - but is part of many other elements that also contribute to the page - EE won't know what this page is, or what the other elements are, but you might.

The key component in both these examples is that EE doesn't know what page the entry will link to - but you do: so the only sensible solution to your question is for you to answer it yourself for each entry you edit.

HTH

1
  • My EE install is actually a database of computers--no public pages, just an organization of data with the easy-to-use interface of EE. There's a field, Warranty Expiration Date, that was not defined for each entry, that now needs to be defined. Dell defines this field if you go to their website with an ID of your computer defined, something like www.dell.com/id/<ID HERE>. So I was thinking of putting this link within each entry, so our content admins can easily look it up and update it. We're working with Dell on a better solution (e.g. data dump), but this is our fallback.
    – jphansen
    Mar 20 '19 at 13:27
0

I ended up messing with the control panel code to generate this link. For anyone who'd like to make a link based on an entry's content in the edit entry interface, here's what I did.

File: system/ee/EllisLab/ExpressionEngine/View/publish/entry.php

Line: 133 (EE 3.5.16), right after the $field->getLabel() call

<?php 
                            if ($field->getLabel() == "Your Label Value") {
                                $form = $field->getForm();
                                preg_match('/value="(\w*)"/', $form, $form_value);
                                echo " - <a href='http://www.site.com/" . $form_value[1] . "' target='_blank'>Go to link</a>"; 
                            }
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.