Static page dropdown within static page in OctoberCMS

后端 未结 3 1080
青春惊慌失措
青春惊慌失措 2021-01-24 03:18

I have a template with a slideshow in it. Each slide consists of:

  • Image
  • Caption
  • A paragraph of text
  • Button

For the first

3条回答
  •  梦毁少年i
    2021-01-24 03:48

    You could use the staticpagepicker widget if you don't need to link to CMS pages. https://github.com/rainlab/pages-plugin#backend-forms

    If you need to select from a list of static pages in your own backend forms, you can use the staticpagepicker widget:

    fields:
        field_name:
            label: Static Page
            type: staticpagepicker
    

    The field's assigned value will be the static page's file name, which can be used to link to the page as described above.

    In your layout file:

    {variable name="button_page" label="Button URL" type="staticpagepicker"}{/variable}
    
    Button
    

    Because CMS Pages aren't listed in this widget, you could always setup an alternative field to offer more flexibility to the user.

    {variable name="button_url" label="Button (URL)" type="text" span="left" comment="Leave empty if using Button (Page) instead" placeholder="http://"}{/variable}
    {variable name="button_page" label="Button (Page)" type="staticpagepicker" span="right" comment="Used if Button (URL) is left empty"}{/variable}
    
    Button
    

提交回复
热议问题