Jump to content

sb17joker

Member
  • Posts

    10
  • Joined

  • Last visited

Posts posted by sb17joker

  1. I have seen this syntax in some scripts that I have downloaded, & it interested me, so I searched for info on it, & have come up with nothing.

     

    I have searched php.net, nothing... is this a php function? a way to end php so html can be used? I don't even know what to call it, it doesn't seem to follow any rules... ie: operator, function, variable.

     

    I have tested it out, & used it as I have seen it being used, such as:

     

    <?php

    $content =<<<HTML

    stuff in middle

    HTML;

    echo "Before ".$content." After";

     

    This outputs "Before stuff in middle After".

     

    if someone could point me to more information on this & what rules apply, I would be grateful.

     

    Thank you

    Scott

     

    ok, seems I actually have found something. It seems that this is what is called heredoc syntax, & it doesn't matter what the letters are, such as

     

    $content =<<<STUFF

    stuff in middle

    STUFF;

     

    echo $content;

     

    does the same as <<<HTML... & heredocs will parse for variables inside curly brackets such as:

     

    $word = "foo";

    $content =<<<HTML

     

    stuff {$word} middle

     

    HTML;

     

    echo $content;

     

    outputs "stuff foo middle";

     

    also learned "nowdoc"s have single quotes around the "name", do similar, but do not parse content such as:

     

    $word = "foo";

    $content =<<<'HTML'

     

    stuff {$word} middle

     

    HTML;

     

    echo $content;

     

    outputs "stuff {$word} middle";

     

    so there is what I have learned in a nutshell... if you have more info I'll still be grateful, I like to learn.

  2. I have seen this syntax in some scripts that I have downloaded, & it interested me, so I searched for info on it, & have come up with nothing.

     

    I have searched php.net, nothing... is this a php function? a way to end php so html can be used? I don't even know what to call it, it doesn't seem to follow any rules... ie: operator, function, variable.

     

    I have tested it out, & used it as I have seen it being used, such as:

     

    <?php

    $content =<<<HTML

    stuff in middle

    HTML;

    echo "Before ".$content." After";

     

    This outputs "Before stuff in middle After".

     

    if someone could point me to more information on this & what rules apply, I would be grateful.

     

    Thank you

    Scott

  3. I believe what you are trying to make is the div in center of the margins to be 100% of the space, to use %'s in margins I believe you would make 0% on both to achieve that...

     

    I believe what you would have with what you have written is 0% on left, 100% on right & no space in between.

  4. This message is targeted at john lebensold, but any answers are welcome :)

     

    I have an application I'm writing, & would like to give the option for customization down the road, but also have it upgradable to version 2.0.. 3.0.. 4.0 in the future without having to edit the main files at the time of upgrade to keep customizations. I have created on one, I have a Cms class, & have made a "customCms extends Cms Class" file, but don't necessarily want to write a blank file for every class so that down the road I can possibly customize it (mainly because when I deploy the new version I don't want to chance overwriting the end programers customizations if I don'[t delete the custom file before packaging). I have this code, but it doesn't do that, it will error if the file is not found. The autoloader works, but the "$Cms = new Cms" doesn't, it errors. Is there a way to load a class only if it exists?

     

    the code I'm using is:

     

    function __autoload($className)

    {

    if(file_exists($filename = str_replace('\\', '/' , $className) . '.php')){

    require_once $filename;

    }else{

    return FALSE;

    }

    }

     

    & this I believe is working, if it doesn't find the file it returns false.

     

    //create cms object

    if(!$this->Cms = new \enterprize\controllers\customCms()){

    $this->Cms = new \enterprize\controllers\Cms();

    }

     

    but this part is not working, even tho I have the if(), it's erroring while it's trying to create $Cms.

  5. Hi guys, I have an issue that I'm coming up with on the content management system setup, I have built out a pretty decent (I think anyways lol) cms from this setup, & have found an issue that is kinda baffling me... I know why, but not sure what to do about fixing it....

     

    if I type

     

    "info   hello <h1 id="bummer">"

     

    in a wysiwyg, or a textbox (maybe even a oneline, not sure) I will get in a print_r($_POST)

     

    Array

    (

    [uri] => ticketing

    [block] => content_maincontent

    [field] => info

    [nbsp;_hello_ "bummer">

    )

     

    I know it has to do with the javascript that builds the datastring, but how to resolve this issue?

     

    var dataString = 'uri=' + uri + '&block=' + block + '&field=' + content;

     

    thanks! Scott

×
×
  • Create New...