Skip to main content
deleted 112 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have an 'index' pagespage defined by default. Essentially there are no uri's for sectionschannels and structures as a whole, only for the entries within that sectionthem. You need to create these index pages yourself, using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have channels that do not represent pages at all, but are just collections of data to be used elsewhereelsewhere; likewise, sections do not really have a way to define order. AsOverall not really a result, there is no good waymechanism to generate navigation by looping through the sectionsnav.

There are, however, other ways to organize your site to facilitate dynamic navigationdo this.

One solution is to use a dedicated Structure whose purpose is to generate your sitespecifically for navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to definegenerate your top level navigation. And usenav, using the EntryType to determine which template code to display.

Either of these techniques can also be combinedused with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should alsoAlso have a look at craft's nav tag in the documentation.

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have channels that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no good way to generate navigation by looping through the sections.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should also have a look at craft's nav tag in the documentation.

There is not really a very simple way to do this. One thing to keep in mind is that channels and structures do not have an 'index' page defined by default. Essentially there are no uri's for channels and structures as a whole, only for the entries within them. You need to create index pages yourself, using:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have channels that do not represent pages at all, but are just collections of data to be used elsewhere; likewise, sections do not really have a way to define order. Overall not really a good mechanism to generate nav.

There are, however, other ways to do this.

One solution is to use a dedicated Structure specifically for navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other pages as needed. You can then loop through that structure to generate your nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a structure using EntryTypes to differentiate the various page types and define the field requirements (i.e. a structure called 'pages' for example). You can then loop through this structure to generate your nav, using the EntryType to determine which template code to display.

Either of these techniques can be used with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. Also have a look at craft's nav tag in the documentation.

deleted 112 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have sectionschannels that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no good way to generate navigation by looping through the sections. Instead you will need to generate navigation using specific logic that represents the organization of your CMS.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should also have a look at craft's nav tag in the documentation.

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have sections that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no good way to generate navigation by looping through the sections. Instead you will need to generate navigation using specific logic that represents the organization of your CMS.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should also have a look at craft's nav tag in the documentation.

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have channels that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no good way to generate navigation by looping through the sections.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should also have a look at craft's nav tag in the documentation.

deleted 2 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have sections that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no singlegood way to generate navigation by looping through the sections. Instead you will need to generate navigation using specific logic that represents the organization of your CMS.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with fieldsa related entries field that linklinks to other entries and/or a custom urlsurl field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should also have a look at craft's nav tag in the documentation.

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have sections that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no single way to generate navigation by looping through the sections. Instead you will need to generate navigation using specific logic that represents the organization of your CMS.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with fields that link to other entries and/or custom urls as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There is not really a very simple way to do this. One thing you need to keep in mind is that channels and structures do not have 'index' pages defined by default. Essentially there are no uri's for sections as a whole, only for the entries within that section. You need to create these index pages yourself using for example:

  • Singles (one for each of your index pages), or
  • a Structure (using different EntryTypes for the different levels and/or page types), or
  • Template files (placed directly in your templates folder)

The other problem is that you may have sections that do not represent pages at all, but are just collections of data to be used elsewhere. As a result, there is no good way to generate navigation by looping through the sections. Instead you will need to generate navigation using specific logic that represents the organization of your CMS.

There are, however, ways to organize your site to facilitate dynamic navigation.

One solution is to use a dedicated Structure whose purpose is to generate your site navigation (called 'primaryNav' for example) with a related entries field that links to other entries and a custom url field to link to other random pages as needed. You can then loop through that structure to generate your hierarchical nav.

Another option is to define all of your top level pages (what might normally be considered singles) within a single structure using EntryTypes to differentiate the various page types and define the unique field requirements of those pages (i.e. a structure called 'pages' for example). You can then loop through this structure to define your top level navigation. And use the EntryType to determine which template code to display.

Either of these techniques can also be combined with other channels and or structures as needed to generate lower level pages where there are many of the same type (i.e. news, blog, articles, projects, etc.).

There are a lot of good examples of this on the exchange site. And you should also have a look at craft's nav tag in the documentation.

deleted 2 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading