Jump to content

Recommended Posts

Thanks make sense. But crashed my site. But why? This is the hole context then.

  $data = [
            $content_slug = ucfirst($page['content_slug']);
            $content_title = ucfirst($page['content_title']);
            'title' => "{$content_slug} ({$content_title}) ",
            'meta.description' => $description,
            'page' => $page,
        ];

        return $app->render($template, $data);
    }

 

Because of the semi-colon at the end of each declaration and those being declared inside $data.

You would need to move them outside like so:

$content_slug = ucfirst($page['content_slug']);
$content_title = ucfirst($page['content_title']);
$data = [
	'title' => "{$content_slug} ({$content_title}) ",
	'meta.description' => $description,
	'page' => $page,
];
return $app->render($template, $data);
}

 

  On 11/3/2021 at 11:56 AM, jarvis said:

Because of the semi-colon at the end of each declaration and those being declared inside $data.

You would need to move them outside like so:

$content_slug = ucfirst($page['content_slug']);
$content_title = ucfirst($page['content_title']);
$data = [
	'title' => "{$content_slug} ({$content_title}) ",
	'meta.description' => $description,
	'page' => $page,
];
return $app->render($template, $data);
}

 

Expand  

That works now. Thank you very much!

  On 11/3/2021 at 9:38 PM, paulmagm said:

And here?        

 breadcrumb_add('page', $page['content_slug']);

i have to learn more php. too much ' for a frontend developer.

Expand  

I'm not able to add ucfirst in this line without crashing the hole website.

What exactly does 'crashing' mean to you/us?  Are you getting an error message?  Do you have error reporting enabled?

You are calling a function with two arguments.  What does the function do? It doesn't appear to return anything so why do you not use the ucfirst function on the 2 args before you use them in the function calll?  That is what I would do.  Or I would use the function on each of the args in the call.

Show us this code that is 'crashing' your hole(?) website.

 breadcrumb_add('Page', ucfirst($page['content_slug']));

The first argument I simply made a change to.  The second arg I added the function to the var you were passing into the function.  Pretty simple, huh?  Of course I am assuming that your var is actually a string.  Correct?

  On 11/4/2021 at 1:14 AM, ginerjm said:
 breadcrumb_add('Page', ucfirst($page['content_slug']));

The first argument I simply made a change to.  The second arg I added the function to the var you were passing into the function.  Pretty simple, huh?  Of course I am assuming that your var is actually a string.  Correct?

Expand  

Now it works. Thank you very much!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.