954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Custom Drupal PHP Block Help

Background:
I have a Drupal site with around 150 users. Each of those users has a spreadsheet that they send to me weekly.
I've uploaded all of the spreadsheets to an Editgrid account and I've created a custom drupal block to display there Live spreadsheet and edit it so removing the need to e-mail the sheet each week.

At the moment i am using the following link embedded into the block, the section that is highlighted (name of the spreadsheet) i would like to be dynamic depending on the user viewing it (so i dont have to make a different block for each user)

<iframe title="An EditGrid spreadsheet created by gdhub/admin" longdesc="http://www.editgrid.com/gdhub/admin/NE01" name="gridContainer" frameborder="0" src="http://www.editgrid.com/publish/grid/gdhub/admin/NE01?show=&version=2&frame_style=border%3A9px%20solid%20%23666%3Bheight%3A700px%3Bwidth%3A100%25" style="border:1px solid #666;height:700px;width:100%">&nbsp;</iframe>


Please bear with me as i have very little knowledge of PHP, but determined to learn

Questions:
Could i replaceNE01 with a print $variable and use the users Drupal $user->uid to select the correct $variable based on an array?

hopefully i've made sense, i may be heading in the wrong direction but would apreciate any pointers..

many thanks

ecdmonkey
Newbie Poster
2 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

I've just found a soloution, might be a workaround but it works

I added a new colomn into the database table user called reports and entered the spreadsheet name for each user into it.

changed my block code to

<?php
global $user;
?>

<iframe title="An EditGrid spreadsheet created by gdhub/admin" longdesc="http://www.editgrid.com/gdhub/admin/<strong><?php print $user->reports ?></strong>" name="gridContainer" frameborder="0" src="http://www.editgrid.com/publish/grid/gdhub/admin/<strong><?php print $user->reports ?></strong>?show=&version=2&frame_style=border%3A9px%20solid%20%23666%3Bheight%3A700px%3Bwidth%3A100%25" style="border:1px solid #666;height:700px;width:100%">&nbsp;</iframe>


and hey presto each user can now see their own sheet

ecdmonkey
Newbie Poster
2 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: