We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Get all the pages in application (urls or urls+content)

How Do I?

Eduard Trayan's avatar
Eduard Trayan
3 posts
9 years ago
Eduard Trayan's avatar Eduard Trayan

Hi all,

Is there any way of how to get links to all the existing pages n the application? The initial task is to create an full initial index for the elastic search, and here I need to get the following data: 1. page url 2. page content

So is there some SQL request, or php solution of how to get all the existing urls in the expression engine (also search spiders are used to get such info)? The similar task is a creation of sitemap, so if is there any solutions for sitemap, I can adapt it to the my task.

Any information is useful, completed solution isn’t necessary, just the ideas are enough.

EE v2.9.3.

Thanks in advance

       
FountainInternet's avatar
FountainInternet
53 posts
9 years ago
FountainInternet's avatar FountainInternet

How you approach this will depend on how you’ve structured your site. For example, I like to create a channel called “Static page” (short name: static_page) and create other channels with short names that match the names of their associated template groups. For example, I might create a channel called “News” (short name: news) and a template group with the name “news”. Also, you might have a small number of channel entries that have been given Page URIs (for example, “About Us” or “Contact Us” pages). With a structure like this, you can build a channel entries query to output a list of page titles like so:

<ul>
{exp:channel:entries dynamic="no"}
 {if page_uri != ""}
  <li><a href="http://{page_uri}">{title}</a></li>
 {if:elseif channel == "news" OR channel == "events"}
  <li><a href="/{channel_short_name}/{url_title}">{title}</a></li>
 {if:elseif channel == "static_page"}
  <li><a href="/{categories">{title}</a></li>
 {/if}
{/exp:channel:entries}
</ul>

The first segment of the static page URI comes from the category URL title in a special category group (id 1 in the above example). This isn’t very scalable if you’ve got a large number of static pages though. However, if you know what the first segment of these static pages will be, then that solves the scalability problem. For example, you could create a template group called “page” with an index template for displaying static pages. In that case, your static page URLs would be /page/{title}.

       
Eduard Trayan's avatar
Eduard Trayan
3 posts
9 years ago
Eduard Trayan's avatar Eduard Trayan

Thanks a lot FountainInternet for advise, I’ll try to use this approach

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.