(Solved) PHPJabbers scripts: Add a template (view)

Hello,

Is anyone familiar with PHPJabbers’ MVC framework? Namely their Member Login script.

I’m wanting to add a new &action (view/template) to the pjFront controller so I can use the framework calls.

I have added the function within the /app/controllers/pjFront.controller.php file named the same as I have the php file I added in the /app/views/pjFront path.

If I visit index.php?controller=pjFront&action={name_of_fuction}, I get output, however, when I use it in a script tag embedded on a page, nothing displays - obviously as it’s not javascript.

I’ve looked at the other pages and noticed that they are wrapped within a document.writeln() javascript function.

Hope I have explained thoroughly. Any guidance will be appreciated.

For context, eg. to display the login page, you’d use:
<script type="text/javascript" src="index.php?controller=pjFront&action=pjActionLogin"></script>

When you say

What do you mean?
Is this page online somewhere we can see it?

In a script tag, the forum removed the < >'s

You need to format code to have it display correctly, @palsyp. For inline code, place a single backtick ` before and after the code; for a code block, place three backticks on a line above, and three on a line below.

You can also highlight your code and use the </> button in the editor window.

1 Like

ah okay, so the PHP is outputting javascript.

Have you got an example of the output you can show us? Is it a valid JS output?

Well, I have sorted it out… I missed a PHP function that wraps the code/html within the javascript’s document.writeln() function when rendering output… :man_facepalming:t2:

I hope you have checked that the script properly hashes the user password. PHPJabbers own website used to store the password as plain text.