Jump to content

Raspberry

Members
  • Posts

    11
  • Joined

  • Last visited

Raspberry's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. Finally found how to do that. http_response_code(303); // See Other 308 is "We don't do this anymore, go ask there from now"307 is "We can't do this currently, go ask there for now"303 is "We did it, now please go there for the next part"
  2. I don't want to send POST data (nor GET data). ^^I want to tell to the browser to NOT ask to resend POST data previously submitted.To prevent the browser popup "You'll be redirected. Do you want to resend data ?" [yes] [no]
  3. Hi!Do you know a way to tell to the browser we don't want to include POST data while making an HTTP redirection?I don't need them and didn't want to see the "Do you want to resend data?" popup client-side.Or a way to change the displayed URL?The current code is : http_response_code(307);header('Location: '.$url);
  4. A generic example of variable initialization from user OPTIONAL input. if(isValidValue($_POST['label'])) $var = $_POST['label'];else $var = DEFAULT_VALUE; Test if $_POST['label'] exists with isset() is the least to do.Also, user input correct testing prevent XSS attack and SQL injection.
  5. You can use the new sandbox attribute for iframe with allow-scripts value. But it's an HTML5 feature, unsupported by IE<10 and Opera. iFrame sandbox
  6. The echo have to display the concatenation of the string "line 2 is echo function :" with the return value of the ifisset() function and the string "\n".For knowing what is the return value of the ifisset() function, the ifisset() function is launch.The ifisset display the content of its parameter and return a null value. (first output)The strings are concatenate with the null value (null value is evaluated as a void string);The echo display the contatenated string. (second output). echo "line 2 is echo function :";ifisset($var_jimmyjoy);echo "\n";//will output the text in the desired order.
  7. Three <body> opening tags, multiple <br />, <table> in <p> for styling purpose, inline CSS.IMO you have to redo properly every pages with external CSS files. If the pages are generated by script, you can make HTML templates and includes them in every page.I work with a PHP MVC framework and View objects have a loadTemplate($name, $data) function.A basic page look like $this->loadTemplate('head', $data); // ($data contain canonical url, page title, css and js filenames, etc.)$this->loadTemplate('header');$this->loadTemplate('meta_navigation');$this->loadTemplate('local/navigation');?><!-- Page content --><?php$this->loadTemplate('footer'); You can use require($templatePath); instead of $this->loadTemplate($name, $data); if you haven't an OO framework.
  8. Raspberry

    Selectors- why?

    If he define his own tags, it's not HTML, it's another language invented by him and unsupported by w3c.It's more important than the default style of the tags.
  9. Raspberry

    Selectors- why?

    <div> and <span> haven't any meaning by themselves, their purpose is grouping elements meaningfully.
  10. Raspberry

    Selectors- why?

    Imagine a navigation menu. <nav> <a href="/home.html">Home</a> <a href="/articles.html">Articles</a> <a href="/forum.html">Forum</a> <a href="/help.html">Help</a></nav> If you want to highlight the current location with CSS, you need a distinguishable element. <nav> <a href="/home.html">Home</a> <a href="/articles.html">Articles</a> <a href="/forum.html" class="here">Forum</a> <a href="/help.html">Help</a></nav> And you style it nav a { /* default design */}nav a.here { /* current location */} Why can't we use <any-name-we-want> tags ? Because it's meaningless.Each html tags have a meaning (h1 for main title, p for paragraph, li for list element...)Only two exceptions exists : <div> and <span>. They're meaningless but can be used for organize a document by grouping content and user generated content styling. It's their purpose.Before HTML5 you usually found <div id="nav"> <div id="head"> <div id="article"> <div id="foot"> elements containing the whole document. A class haven't to be meaningful, and you can combine them. <a class="highlight" href="/home.html">Home</a><a class="external-link" href="http://www.exemple.net/">www.exemple.net</a><a class="external-link highlight" href="www.w3.org">W3C.org</a>
×
×
  • Create New...