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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

php code into silverstripe


Go to End


4 Posts   1047 Views

Avatar
Samal

Community Member, 2 Posts

14 December 2012 at 9:54am

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

Forum Moderator, 922 Posts

19 December 2012 at 4:23pm

Edited: 19/12/2012 4:25pm

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

Community Member, 96 Posts

20 December 2012 at 12:50am

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

Community Member, 2 Posts

23 December 2012 at 9:32am

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