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.

Add custom field or used something already here

Discussion in 'General Support' started by menardmam, Mar 28, 2012.

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

    Brian EPC Developer Staff Member

    To do what you're asking, my best advice is that you would need to capture the output from the list mode (ob_start, etc.). Then you can manipulate the output any way you want by searching/replacing, etc.. This can/would not be a supported modification as it is beyond the scope of it's intended use.
     
  2. menardmam

    menardmam New Member

    show me

    OK, now we go somewhere... So next step, can you tell/show me how to capture that output ?, example of code ? step-by-step instruction
     
  3. Brian

    Brian EPC Developer Staff Member

    If you would like for us to create a custom script for you, please open a support ticket so we can work out the details.
     
  4. menardmam

    menardmam New Member

    dev

    I like you to do it FREE or tell me wich file i can modify to get some php. It's your code, but when i buy it, i must be able to do it myselft, not asking you to do it....
     
  5. menardmam

    menardmam New Member

    ticket-update

    I still running version 6. i see there is version 7.. how upgrading can help me ?
     
  6. ve9gra

    ve9gra Support Team

    Ok, lets clear the air about a few things... You bought a license. This allows you the use of the product. You did not buy the code, which would allow you to modify the product. Think of it in the same way as Microsoft Windows, or Office. Do you think Microsoft is ever going to let you have the code so that you can modify stuff to your liking?

    Having said that, the templating that is done in EPC does allow for some customization of the output of the calendar. The customization that you're asking for is simply not available. Like Brian said, you cannot have PHP in the template. If you want to modify the output of the template beyond that, you will have to "do it yourself".

    In my previous post I made it clear that the example I was showing you required the use of the main category. Since you do not want to modify your setup to use the main category, Brian suggested you use ob_start() to capture the output. That should have put you on the right track.

    We (note that I'm not associated with EPC) try to be as helpful as possible, however it is not our place to teach clients how to use PHP. There are plenty of resources online for that, that will do a better job than we could.

    That being said, I will explain how to go about to get what you want... but you have to understand that this is absolutely not supported in any way, shape, or form... and if, when you decide to upgrade to V7, the thing breaks EPC is not responsible for fixing it. Now, I will explain, but I will not do it for you... you will have to work at this to implement it.

    1. Prepare the CSS

    Wherever you have your CSS, add the following class

    HTML:
    .epcFloatImg { float: right; }
    2. Prepare your sub-category

    If you haven't done so already, create a sub-category that will hold your different selections. In this example I'm going to use "Host" as the name of the category, so that it still makes sense if you want to display the text somewhere else on your site. Once the category created, add all the values that you want to be available. For this, I'm going to use "Linda", "Jane", and "Sophie" as examples.

    3. Prepare your images

    Upload the images to your site to a common location… /images is usually a good idea. And for simplicity, I'm only going to use the <host's name>.jpg for this example. So we have "/images/Linda.jpg", etc…

    4. Capture the List output

    Right now, you have a section of code that starts with $LIST=1; and ends with require("calendar.php"); [the path to calendar.php may be different]. This is what generates the List mode. To capture the output, we'll use output buffering. You do that by starting the capture just before the require(), and returning the output just after the require(), like so:

    PHP:
    ob_start();
    require(
    "calendar.php");
    $epcOutput ob_get_clean();
    5. Setting up the values for the replacement

    Now that we've captured the output, we're going to process it. First, we must define what we're searching for, and what we're going to replace it with. You can find what you're searching for by looking at the web page source code and looking for the category. In this example's case, here's what we get for the "Linda" selection:

    HTML:
    <div><strong>Host:</strong> Linda</div>
    So, from that we can define each selection that we want to replace in a variable that we'll use later

    PHP:
    $epcSearch = array("<div><strong>Host:</strong> Linda</div>""<div><strong>Host:</strong> Jane</div>""<div><strong>Host:</strong> Sophie</div>");
    And now, we need to define what those are going to be replaced with

    PHP:
    $epcReplace = array("<img class='epcFloatImg' src='/images/Linda.jpg'>""<img class='epcFloatImg' src='/images/Jane.jpg'>""<img class='epcFloatImg' src='/images/Sophie.jpg'>");
    Note that you need to match the position between the search and the replace.. Linda is the first in both, Jane is second in both, etc…

    6. Replacing the values

    Now, we'll use str_replace to actually do the replacing

    PHP:
    $epcReplaced str_replace($epcSearch$epcReplace$epcOutput);
    7. Final output

    And, now the final step… outputting our modified List

    PHP:
    echo $epcReplaced;
    That's it. If you want the image to be to the right instead, just modify the CSS in step 1.

    So... all together (except for the CSS), the code should look something like this

    PHP:
    $LIST=1;
    $DF "M jS, Y (D)"
    $template="modern.php";
    ob_start();
    require(
    "calendar.php");
    $epcOutput ob_get_clean();

    $epcSearch = array("<div><strong>Host:</strong> Linda</div>""<div><strong>Host:</strong> Jane</div>""<div><strong>Host:</strong> Sophie</div>");
    $epcReplace = array("<img class='epcFloatImg' src='/images/Linda.jpg'>""<img class='epcFloatImg' src='/images/Jane.jpg'>""<img class='epcFloatImg' src='/images/Sophie.jpg'>");
    $epcReplaced str_replace($epcSearch$epcReplace$epcOutput);

    echo 
    $epcReplaced;
     
  7. menardmam

    menardmam New Member

    Finaly

    OH BOY, it took me a week and 15 messages, but finally somebody answer something intelligent and useful. Thanks.

    Can i ask you something. For sure the how-to guide should work fine, but i have read somewhere that you can add some plugin for some $$ and i am ready to pay 50-100$ for that...

    Can you just add a feature where i write [categorie-id] in the template it will output just the "name" or the string of the subcategory, just as you do for the [category], it output something useful (a string) to use as class

    So, it's already done for category, it's should be "kind of" simple to make a function for the [categorie]. if it's possible, i will be in heaven and i will transfer $ with PayPal in the day !

    It's will get the code cleaner, because the templating system is SUPER easy, and having that little function will help a lot, not just me

    So it will be <img src="../images/[categorie-id].jpg"> and the final html result will be : <img src="Lynda.jpg"> and everything will be keep simple and clean.

    Thanks a million time for the great support and great help, and i still loving this plugin ! :)
     
  8. ve9gra

    ve9gra Support Team

    Plugins are 100% separate from the List mode... they live on their own. Building that feature would require modification to the source code. However, just like you, I do not have access to the source code, so no I cannot build you that option.

    The problem with what you're asking is that it's impossible to know which category you would want to use... since you can have multiple sub-categories. That's why the system outputs text for all of the sub-categories.

    And I understand what you want to do, but that would require building you a complete custom version of the calendar. I'm sure you can understand that it would be impossible to keep the code in sync and up-to-date if there was several thousand customized versions of the calendar.
     
Thread Status:
Not open for further replies.

Share This Page