Jump to content

Recommended Posts

Posted

I am rebuilding a website. Templates include a field "url_old" with a href to the page's URL on the old website. By surfing to the /redirect, the system should generate a list that can be copied and pasted into a .htaccess file. In order to find all of the pages that need to be redirected, I use the following in the template "redirect" (used by a single page located at home/redirect/):

$results = $pages->find("url_old!=''");

To the best of my knowledge, $results should contain ALL pages with a field "url_old" that isn't empty. However, when the data is generated, it includes only the home page and all of the home page's children that have children of their own.

Let me illustrate with an example:

Home
  |- Page 1
  |- Page 2
  |     |- Page A
  |     |- Page B
  |- Page 3
  |- Page 4

Let's assume that all of these pages have the "url_old" field filled in. You would expect the system to generate a list of ALL of these pages. Instead, it only lists "Home", "Page 2", "Page A", and "Page B". Somehow, it skips "Page 1" and the others. (When I do a count() of $results, it also lists just the pages that are shown, so 4 in this example, instead of 7.)

I get the idea that I'm missing something obvious, but I can't see what. Anyone care to help?

Posted

Suddenly had a bright idea. The missing pages were set to "hidden". I needed to use:

$results = $pages->find("url_old!='',include=hidden");

I'm leaving this page as a monument to my own stupidity. :rolleyes:

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...