1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. To combat forum spam, new accounts will need to make at least one (valid) post.
    Otherwise, we will periodically purge all users without posts or that haven't confirmed their account.

Category Display Parsing

Discussion in 'Customizations (Themes / Templates)' started by MadZebra, Nov 21, 2007.

Thread Status:
Not open for further replies.
  1. MadZebra

    MadZebra New Member

    I'm trying to customize the output of the [categories] display. I just want it to display the selection, not the actual category. For example, I have a selection named Youth Events under the category of Display Categories. When I parse [categories] is comes out as Display Categories: Youth Events.

    I've tried leaving the category name blank. When I do this, it parses as : Youth Events. I just want is to say Youth Events with no extra text. Any suggestions?
     
  2. ve9gra

    ve9gra Support Team

    It is not possible to actually modify the code that generates it, but with some crafty PHP, you can modify it after the fact.

    Name your category with some weird characters like §¶£¤³ and make sure that it outputs properly in the HTML (not like &).

    On the page where you're displaying your list, you'll need to use output buffering. So, in your $LIST section, this is how you'll want to have it.
    PHP:
    $LIST=1;
    [
    all of your options]
    ob_start();
    require(
    "calendar/calendar.php");
    $epcListOutput=ob_get_clean();
    So, now we have the list output saved into a variable. We can now use the PHP text functions to go in a strip out what we don't want and then display the modified version. For this example, we'll say that you did name your category "§¶£¤³".
    PHP:
    $epcListOutput=ereg_replace("§¶£¤³: """$epcListOutput);
    echo 
    $epcListOutput;
    Note that the text you're looking for is the name of the category, plus ": " because you also want to remove the colon and the space.
     
  3. MadZebra

    MadZebra New Member

    Minor tweak

    Thanks for the quick reply. After a little tweaking, I got the output to come out the way I wanted it to. One minor tweak was needed to get this working. Your code:

    Code:
    [FONT=Courier New][COLOR=#0000bb]$epcListOutput[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]ereg_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"§¶£¤³: "[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]""[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$epcListOutput[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]echo [/COLOR][COLOR=#0000bb]$epcListOutput[/COLOR][COLOR=#007700];  [/COLOR][/FONT]
    Should read:
    Code:
    [FONT=Courier New][COLOR=#0000bb]$epcListOutput[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]ereg_replace[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"§¶£¤³:"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]""[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$epcListOutput[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); [/COLOR][/FONT]
    [FONT=Courier New][COLOR=#007700]echo [/COLOR][COLOR=#0000bb]$epcListOutput[/COLOR][COLOR=#007700];  [/COLOR][/FONT]
    The space after the colon was throwing everything off. For those who are looking to do this, the random characters aren't needed for this to work, you just want to make sure that your new category name is unique and not "category."
     
Thread Status:
Not open for further replies.

Share This Page