Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

metronic: Problem in Custom js in Laravel


when I want to have a "path" like this:
account/annunci/4/edit

I can't get the "js" in the "config/global/pages.php" file to work

my config:


"account" => array(
"annunci" => array(
"title" => "Lista annunci",
"assets" => array(
"custom" => array(
"css" => array(
"plugins/custom/datatables/datatables.bundle.css",
),
"js" => array(
"plugins/custom/datatables/datatables.bundle.js",
),
),
),

"create" => array(
"title" => "Aggiungi Annuncio",
"assets" => array(
"custom" => array(
"css" => array(
"plugins/custom/datatables/datatables.bundle.css",
),
"js" => array(
"plugins/custom/datatables/datatables.bundle.js",
"js/custom/account/annunci/create-annuncis.js",
),
),
),
),
"*" => array(
"edit" => array(
"title" => "Modifica Annuncio",
"assets" => array(
"custom" => array(
"js" => array(
"js/custom/account/annunci/edit-annuncis.js",
),
),
),
),
),
),

My JS is not added to the view. But if I put the numeric id instead of the asterisk, it works.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Hi try putting your path inside of the asterisk. Like this.


"*" => array(
"annunci" => array(
"title" => "Lista annunci",
"assets" => array(
"custom" => array(
"css" => array(
"plugins/custom/datatables/datatables.bundle.css",
),
"js" => array(
"plugins/custom/datatables/datatables.bundle.js",
),
),
),



Hi,

Could you please try to put the * object at the top?



Thanks



This is my original "array".




Alla fine io ho modificato questa funzione perché non riusciva a prendere le pagine quando dovevo editare qualche pagina.



By modifying the "getOption" function in "app/Core/Adapters/Theme.php",
it works with all levels and is read only once.



Hi Gabriele,

Thank you for the solution. We will add it as a fix.

Thanks



Hi, I'm having the same problem too, the custom JS would not load. Kindly assist me too, thank you very much


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(