根据条件旋转文章(不是随机的)


spin article, based on condition (not random)

我在这里找到了一些用于旋转的代码。

尝试添加if/else。但是不能使它像下面描述的那样工作。

我想做的是;根据$dom的值,更改文本的某些部分。在这个例子中;如果点击"dom=com"链接,文本应该是"这是域名.com吗?"如果不是,那么"这是域名"。我们 ?"我想这样做的原因是;我计划将这段代码用于一些停放的域名,因此文本的某些部分将有所不同。

    <h1><a href="/test.php?dom=com">com</a> | <a href="/test.php?dom=us">us</a></h1>
    <?
    $dom = $_GET['dom'];
    function spin($var){
    $words = explode("{",$var);
    foreach ($words as $word)
    {
        $words = explode("}",$word);
        foreach ($words as $word)
        {
            $words = explode("|",$word);
    if ($dom = "com"){$word = $words[0];}
    else {$word = $words[1];}
    echo $word." ";
        }
    }
    }
$text = "<font size='"6'">is this the domain {<b>.com</b> |<b>.us</b> } ?, so you are from {anywhere|usa} ?</font><br />";
    spin($text);
    ?>
printf("<font size='"6'">is this the domain <b>%s</b> ?</font><br />",$_GET['dom']);

谁知道这个函数是用来…

<?php
    $dom = $_GET["dom"];
    echo "Is this the domain.".$dom."?";
?>