使用 PHP 和 PHP 管理主题编辑jQuery

发布于 2024-09-16 03:14:44 字数 666 浏览 3 评论 0原文

我有一个主题,其中有很多选项,例如:-

  • 在许多可用的设置主题类型中设置
  • 主体背景颜色和主题类型。图像
  • 设置标题和页脚图像
  • 设置常规字体、大小和字体颜色
  • 设置文本区域背景颜色、字体和颜色字体颜色
  • 设置表单区域背景颜色和颜色圆角选项
  • 设置表单元素背景颜色、字体和字体字体颜色
  • 设置链接默认颜色、悬停颜色和颜色访问过的颜色,带/不带装饰
  • 提供上传任意数量的图像以在用户的​​博客中使用的选项
  • 以及更多...

任何人都可以提供任何信息,说明如何使用自定义 PHP 以最佳方式完成此操作& jQuery? 我也对其他方式持开放态度。

编辑:-
我已经解决了大约 12 个主题,以及它们自己的样式表定义和样式表。图标包。我还让它们适应每个顾客的个人品味。 我不知道的是,如何管理该客户从自己的帐户对客户主题选择所做的更改? 这必须在以下两种情况下生效:-

  • 当客户进行/ 从他的帐户中加载更改
  • 当客户查看他的帐户以及更改时,

,顺便说一句,非常感谢两个用户和用户的快速响应。让我知道我不完整的问题。

非常感谢任何帮助。

I have a theme in which there are numerous options, like:-

  • Setting Theme Type among many available
  • Setting Body Background Color & Image
  • Setting Header & Footer Images
  • Setting General Font Face, Size & Color
  • Setting Text Area Background Color, and Font Face & Font Color
  • Setting Form Area Background Color & Rounder Corners option
  • Setting Form Element Background Color, and Font Face & Font Color
  • Setting Link Default Color, Hover Color & Visited Color, with / without decoration
  • Providing options to upload any number of Images to be used in the user's blog
  • and many more...

Can anybody please provide any info as to how this can be done in a best possible way, using custom PHP & jQuery?
I'm also open to other ways around.

EDIT:-
I have got some 12 themes all worked out, along with their own style sheets defined & icon packs. I have also got them to load upon each of the customer's personal taste. What I don't know is that how to manage the changes made to the customer's theme choice by that customer from his own account? This has to take effect both the times :-

  • when the customer is making / loading the changes from his account
  • when the customer is viewing his account along with the changes

BTW, many many thanks for such a quick response, by two users & letting me know about my incomplete question.

Any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赠佳期 2024-09-23 03:14:44

尝试这样的操作:

<?php

    function template($file, $data = array())
    {
        ob_start();
        extract($data);
        include_once 'path/to/theme/folder/' . $file . '.php';
        return ob_get_clean();
    }


    // Assign values to the template file
    $values['theme_type'] = 'default';
    $values['bg_color'] = '#FFFFFF';
    $values['bg_image'] = 'path/to/bg/image.jpg';
    $values['font_face'] = 'Tahoma, Arial, Verdana';
    $values['font_size'] = '12px';
    $values['font_color'] = '#000000';
    // And so on...

    // Output template file
    echo template('theme_layout', $values);

?>

'path/to/theme/folder/theme_layout.php' 中的 theme_layout.php 文件应如下所示:

<html>
<head>
    <title>Theme Name</title>
    <style type="text/css">
        body {
            background-color: <?php echo $bg_color; ?>;
            background-image: url(<?php echo $bg_image; ?>);
            font-family: <?php echo $font_face; ?>;
            font-size: <?php echo $font_size; ?>;
            font-color: <?php echo $font_color; ?>;
        }
    </style>
</head>
<body>

    Theme type is: <?php echo $theme_type; ?>

</body>
</html>

更新

你是对的,这只是一个概念,这就是你必须做的:例如在数据库 user_themes 中添加新表,并在那里保存所有与用户相关的值。例如,用户进入管理页面并看到主题选项,例如背景颜色/图像、字体名称/大小/颜色,并在其中输入自己的值...提交表单并将值保存在数据库中。然后在主题显示期间(我向模板文件分配值),您可以让用户从数据库输入主题选项并分配为主题值。

我真的不明白应该在哪里使用 jQuery,也许是在用户提交选项的表单中。

希望这有帮助。

Try something like this:

<?php

    function template($file, $data = array())
    {
        ob_start();
        extract($data);
        include_once 'path/to/theme/folder/' . $file . '.php';
        return ob_get_clean();
    }


    // Assign values to the template file
    $values['theme_type'] = 'default';
    $values['bg_color'] = '#FFFFFF';
    $values['bg_image'] = 'path/to/bg/image.jpg';
    $values['font_face'] = 'Tahoma, Arial, Verdana';
    $values['font_size'] = '12px';
    $values['font_color'] = '#000000';
    // And so on...

    // Output template file
    echo template('theme_layout', $values);

?>

And the theme_layout.php file in 'path/to/theme/folder/theme_layout.php' should look like this:

<html>
<head>
    <title>Theme Name</title>
    <style type="text/css">
        body {
            background-color: <?php echo $bg_color; ?>;
            background-image: url(<?php echo $bg_image; ?>);
            font-family: <?php echo $font_face; ?>;
            font-size: <?php echo $font_size; ?>;
            font-color: <?php echo $font_color; ?>;
        }
    </style>
</head>
<body>

    Theme type is: <?php echo $theme_type; ?>

</body>
</html>

Update

You are right that was only the concept, here's what you have to do: Add new table in database user_themes for example and save all user related values there. For example user enters the admin page and sees a theme options like BG Color/Image, Font Name/Size/Color and enters his own values there... Form is submitted and values are saved in the database. Then during the theme display (where I assigned values to the template files) you get user entered theme options from database and assign as a theme values.

I really don't understand where jQuery should be used here, maybe in the form where user submits his options.

Hope this is helpful.

随梦而飞# 2024-09-23 03:14:44

创建各种样式表 (.css)。每个样式表代表一个主题。更改 元素的 href 属性以匹配所选主题的路径。

如果您允许用户上传 CSS 文件,请确保清理输入,因为 IE 能够像 JavaScript 一样执行 CSS 文件的部分内容,从而导致可能的 XSS 攻击。

Create various stylesheets (.css). Each stylesheet represents a theme. Change the <link> element's href attribute to match the path to the selected theme.

If you're allowing user-uploaded CSS files, make sure to sanitize the input, as IE has the ability to execute parts of a CSS file as if it were JavaScript, leading to possible XSS attacks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文