1

I am new to EE and working my way around the CMS. I have worked with WP and Joomla.

The task I have is to build an admin functionality where the admin can select either a URL or upload a file and this will show up as a list of links (either redirect to that URL or download the uploaded file)

Is creating a custom field type the way to go about this? Please let me if there is a sample code for this that I can follow the programming guidelines.

Thanks,

2
  • 4
    You can probably achieve this with a matrix type of field or a grid type of field. Simply have two columns (file and url) and redirect to the url or file accordingly.
    – GDmac
    Oct 4, 2013 at 19:29
  • Agreed, I don't think anything custom would be needed here. Welcome to ExpressionEngine :P Oct 4, 2013 at 19:56

1 Answer 1

3

As folks mention above, no custom development is needed here. Just use the native Grid fieldtype with two columns - one using the File fieldtype (called, say, file), and the other using the Text fieldtype (called, say, url).

Then, in your template:

{my_grid_field}
    {if my_grid_field:file}<a href="{my_grid_field:file}">Download this file</a>{/if}
    {if my_grid_field:url}<a href="{my_grid_field:url}">Visit this link</a>{/if}
{/my_grid_field}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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