• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

    • ⚠️ Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • ✅ Confirm that the server meets the System Requirements
    • 🔥 Check for any available Hotfix - your issue could be already reported/fixed
    • 📚 Read documentation - It will be required to Debug and understand Errors for a faster support response

Making "embed codes" the default tab

shaowenqian666

Chevereto Member
我搜索了整个论坛,仅发现模糊的信息。我想将“嵌入代码”作为默认选项卡。

假设我对编辑php和js文件的经验很少。我知道如何查找和编辑文本,但是我不理解源代码。

因此,请任何人用简单的英语简单地告诉我,我如何使“嵌入代码”默认标签在用户上传图像后首先使用。

请不要提供含糊的信息。我在这里浪费了几个小时,试图自己弄清楚,却没有找到明确的答案。令我感到惊讶的是,嵌入代码并不是默认开始的,因为它的主要功能是使人们比其他人更喜欢一个图像托管站点。谁想额外点击?
 
中文:
将 "app/routes/route.image.php" 文件复制进同目录"/overrides"文件夹下,此时文件路径为 "app/routes/overrides/route.image.php" ,打开并修改此文件(大概在第128行左右):
[CODE lang="php" title="源文件如下"]//源文件如下
$tabs = [
[
'label' => _s('About'),
'id' => 'tab-about',
'current' => true,
],
];
if (CHV\isShowEmbedContent()) {
$tabs[] = [
'label' => _s('Embed codes'),
'id' => 'tab-embeds',
];
}

if ($handler::getCond('content_manager')) {
if ($handler::getCond('admin')) {
$tabs[] = [
'label' => _s('Info'),
'id' => 'tab-info',
];
}[/CODE]

修改后的代码如下:
[CODE lang="php" title="修改后的代码如下"]//修改后的代码如下
$tabs = [
[
'label' => _s('About'),
'id' => 'tab-about',
],
];
if (CHV\isShowEmbedContent()) {
$tabs[] = [
'label' => _s('Embed codes'),
'id' => 'tab-codes',//此处改动Ⅰ
'current' => true,//此处改动Ⅱ
];
}

if ($handler::getCond('content_manager')) {
if ($handler::getCond('admin')) {
$tabs[] = [
'label' => _s('Info'),
'id' => 'tab-info',
];
}[/CODE]

Ⅰ:此处修改是因为 "Chevereto\app\themes\Peafowl\views\image.php:345" 处 "<?php echo get_current_tab() == 'codes' ? ' visible' : null; ?>" 可能是作者疏忽写错了:"embeds" 与 "codes" 🤣

Ⅱ:此处修改,即可改变默认选项卡为 "嵌入代码"

大功告成!


English:
I'm sorry, this is a Chinese answer.
 
I just tested this and Embed Codes do become the default tab but the codes only show after refreshing the page, any one else tried yet?
 
I just tested this and Embed Codes do become the default tab but the codes only show after refreshing the page, any one else tried yet?

Sorry, I was negligent and not rigorous enough.

PHP:
        $tabs = [
            [
                'label' => _s('About'),
                'id' => 'tab-about',
            ],
        ];
        if (CHV\isShowEmbedContent()) {
            $tabs[] = [
                'label' => _s('Embed codes'),
                'id' => 'tab-embeds',
                'current' => true,//Edit here
            ];
        }

        if ($handler::getCond('content_manager')) {
            if ($handler::getCond('admin')) {
                $tabs[] = [
                    'label' => _s('Info'),
                    'id' => 'tab-info',
                ];
            }

Copy the file: "/app/themes/Peafowl/views/image.php" => "/app/themes/Peafowl/overrides/views/image.php"

Edit this code line 345:
PHP:
<?php echo get_current_tab() == 'codes' ? ' visible' : null; ?>"

//Change "codes" to "embeds"

<?php echo get_current_tab() == 'embeds' ? ' visible' : null; ?>"
 
Back
Top