Custom search via PHP string?

First off, I just want to say that PHP is something I don't understand that well. That being said:

Is there a way to define a custom search within a PHP string?
Example: <?php getSearchWords("featured"); ?>

What I am trying to do is upon arrival to the index.php page a search result of the albums with the tag "featured" all show up. Make sense? Any help would be appreciated!

Comments

  • You could do a redirect to index.php?p=search&words=featured
  • csx Member
    Hah, good idea. I'll give that a shot. Thanks.
  • csx Member
    Ok... maybe i'm not executing this right, but by forwarding the site to index.php?p=search&words=featured, it seems to load to the search.php page with the results, not the index.php which has a custom layout and all? Any ideas?
  • Searching always involves the search page. You could modify that page to fit your scheme.
  • csx Member
    That's what I thought. Unfortunately I need to use the search page as a search page. What I'm trying to do is somehow flag an album as featured, then pull in all featured albums to the index page. Is there any simple way of doing this? Thanks for the help!
  • you could put a condition inside the loop in your album.php/index.php
    to do such things I use an unused field like 'location' and fill in on the admin page 'featured' as location for the album.
    within the loop on the album php I check with getAlbumPlace() and only the albums which have 'featured' get printed
    `<?php while (next_album()): ?>

    <?php $check = getAlbumPlace();<br />
    $check = substr_count($check,"featured");

    if ($check == 1) { ?>

    //do your regular album things here

    <?php} else {;}?>

    <?php endwhile; ?>`
  • csx Member
    I'll give that a shot, thanks Bert.
  • There seem to be a number of uses for a custom field. I think we will add such a field to the database so you won't have to reuse a standard field (and possibly get undesired side effects.)
  • csx Member
    That would be great! Can we expect this change in the near future? Thanks!
Sign In or Register to comment.