Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8793831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:10:22+00:00 2026-06-13T23:10:22+00:00

I am implementing a snippet-based content management system into my current project. Snippets can

  • 0

I am implementing a snippet-based content management system into my current project. Snippets can be associated with a page either by exact match of the full url falling back to a wildcard match on a partial url or finally a default snippet.

To implement this I have a created table of page associations with a wildcard flag, the system first checks the current url against the non-wildcard associations and if it doesn’t find a match it checks against the partial url’s where the wildcard flag is set.

In order to achieve this I am getting all the partial url’s from the database and putting them into an array then walking the array to check for a match against the current url:

protected function _check_wildcard($url = NULL)
{
    if($url)
    {
        $q = $this->db->where('wildcard' ,'Y')
                ->from('content')
                ->get();
        $wildcards = $q->result_array();

        foreach($wildcards AS $wildcard)
        {
            if(strpos($url,$wildcard['url']) !== FALSE )
            {
                return $wildcard['snippet_id'];
            }
        }
    }
    else
    {
        return NULL;
    }
}

Can anyone suggest a better way to do this – preferably one that doesn’t involve having to constantly download the full list of all the wildcards each time I load a page as I am afraid that this will have a negative effect on the scalability of the system down the line?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:10:23+00:00Added an answer on June 13, 2026 at 11:10 pm

    You could query your database directly instead of loading all the wildcards. Assuming MySQL, this query checks for the wildcard URL in the given URL string. Ex :

    // Keeping your current wildcard = 'Y' condition and adding the wildcard check.
    $where = "wildcard = 'Y' AND INSTR('" . $url . "', url) > 0 ";
    $this->db->where($where)->from('content')->get();
    

    You can check for your database’s documentation to see if it supports INSTR or a similar function.

    If this query returns no rows, you can return NULL and if it has a row, you can return the first snippet_id.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing schema rich snippet to a Magento store for Product page, and would
I'm stuck in implementing rich snippets on my website. The page respects the schema.org/MusicEvent
I'm implementing a Rails application in which users will be able to store snippets
I am implementing a simulated b/s stock data system. I am using flex and
For a particular piece of homework, I'm implementing a basic data storage system using
I am implementing a simple event system in c++. the system is designed to
The following (simplified) snippet is taken from an application I'm implementing which consistently uses
i am using jqgrid with codeigniter. i am implementing inlinenav using following snippet. here
I am implementing memset() method. Below is the code snippet: void my_memset(void* ptr, int
I'm having trouble implementing this. From other questions I have the following snippet: jQuery.expr[:].Contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.