Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

php code into silverstripe


Reply

4 Posts   637 Views

Avatar
Samal

14 December 2012 at 9:54am Community Member, 2 Posts

Hello,

how can I add extern php code into silverstripe admin?

I have eight pages that are written using PHP. Now I want to put the pages in the admin section of SilverStripe. Pages will be a part of Silverstripe.

Is that possible?

Thanks

Avatar
Sean

19 December 2012 at 4:23pm (Last edited: 19 December 2012 4:25pm), Forum Moderator, 921 Posts

There is no way to add PHP into the admin panel directly from a users perspective, you will have to convert the PHP scripts into page types yourself, as per SilverStripe documentation.

What sort of scripts are they?

Sean

Avatar
Bereusei

20 December 2012 at 12:50am Community Member, 94 Posts

If you use an ModelAdmin for your DataObject, you can replace it with the RemodelAdmin.
With this module, you can include in the ModelAdminPanel buttons witch call an php-file:

In remodeladmin/templates/Includes/RemodelAdmin_right.ss:
<div class="controlbuttons">
<button id="btn1">Do something</button>
</div>

In remodeladmin/javascript/remodeladmin.js:
$('#btn1').click(function(){ $.post("remodeladmin/php/dosomething.php", { id: $(this).val(), status: "status1" }); });

In remodeladmin/php/dosomething.php you can catch the id and the status:
$id = $_POST['id'];
$status = $_POST['status'];
function dosomething(){ do it }

Hope it helps.

Avatar
Samal

23 December 2012 at 9:32am Community Member, 2 Posts

Hello Sean,

thank you for your answer. That's not a script, there are only php codes, they are wirtting by hands. You could see this in attach!

How can I convert this in page types?

Thanks again for your help!

Samal

Attached Files