简体   繁体   English

PHP-需要帮助添加按钮和文本对齐方式

[英]php - need help in adding button and text alignment

Please help me in adding button for the download link and align it to center of the page. 请帮助我添加下载链接的按钮,并将其与页面中心对齐。

Thanks in advance. 提前致谢。

The code written as follows: 该代码编写如下:

<?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;
    }

  }
}

It might help you 可能对您有帮助

 .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; } 
 <p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM