首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php -在添加按钮和文本对齐方式方面需要帮助

php -在添加按钮和文本对齐方式方面需要帮助
EN

Stack Overflow用户
提问于 2016-02-18 19:52:22
回答 1查看 36关注 0票数 1

请帮助我添加下载链接的按钮,并将其对齐到页面的中心。

提前谢谢。

代码编写如下:

代码语言:javascript
复制
<?php
    // show download link?
    $allow_save = false;
    if ( ! empty( $links[1] ) ) {   // link empty = secure document; ignore any other save attribute
        if ( $save == "all" || $save == "1" ) {
            $allow_save = true;
        } elseif ( $save == "users" && is_user_logged_in() ) {
            $allow_save = true;
        }
    }

    if ( $allow_save ) {
        // build download link
        $linkcode = '<p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p>';
        $linkcode = str_replace( "%LINK%", $links[1], $linkcode );

        // fix type
        $ftype = strtoupper( $fnp[1] );
        if ( $ftype == "TIF" ) { 
            $ftype = "TIFF";
        }

        // link attributes
        if ( $profile['link_mask'] == "yes" ) {
            $attr[] = ' rel="nofollow"';
        }
        $attr[] = gde_ga_event( $file ); // GA integration
        $linkcode = str_replace("%ATTRS%", implode( '', $attr ), $linkcode);

        // link text
        if ( empty( $profile['link_text'] ) ) {
            $profile['link_text'] = __('Download', 'google-document-embedder');

        }


        $dltext = str_replace( "%FILE", $fn, $profile['link_text'] );
        $dltext = str_replace( "%TYPE", $ftype, $dltext );
        $dltext = str_replace( "%SIZE", gde_format_bytes( $status['fsize'] ), $dltext );

        $linkcode = str_replace( "%TXT%", $dltext, $linkcode );
    } else {
        $linkcode = '';
    }

    // link position
    if ( $profile['link_pos'] == "above" ) {
        $code = $linkcode . "\n" . $vwr;
    } else {
        $code = $vwr . "\n" . $linkcode;
    }

  }
}
EN

回答 1

Stack Overflow用户

发布于 2016-02-18 19:58:01

这可能会对你有帮助

代码语言:javascript
复制
.gde-text{
  text-align: center;
}
.gde-text a {
  background-color: gold;
  border-radius: 10px;
  color: green;
  font-family: times new roman;
  padding: 10px;
  text-decoration: none;
}
代码语言:javascript
复制
<p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35480721

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档