Difference between revisions of "IframeEmbedding1"

From WeBWorK_wiki
Jump to navigation Jump to search
m
Line 5: Line 5:
 
This PG code shows how to embed content using an <code>iframe</code> in html.
 
This PG code shows how to embed content using an <code>iframe</code> in html.
 
</p>
 
</p>
* Download file: [[File:IframeEmbedding1.txt]] (change the file extension from txt to pg when you save it)
 
  +
* Download file: [[https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/IframeEmbedding1.pg]]
 
* File location in NPL: <code>FortLewis/Authoring/Templates/Misc/IframeEmbedding1.pg</code>
 
* File location in NPL: <code>FortLewis/Authoring/Templates/Misc/IframeEmbedding1.pg</code>
   
Line 100: Line 100:
 
<p>
 
<p>
 
<b>Main Text:</b>
 
<b>Main Text:</b>
  +
Include the <code>$slideshow</code> wherever you like.
 
</p>
 
</p>
 
</td>
 
</td>

Revision as of 16:52, 28 June 2014

HTML iframe Embedded Content

Click to enlarge

This PG code shows how to embed content using an iframe in html.

  • Download file: [[1]]
  • File location in NPL: FortLewis/Authoring/Templates/Misc/IframeEmbedding1.pg


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
"PGcourse.pl",
);
TEXT(beginproblem());

Initialization:

Context("Numeric");

$slideshow = MODES(
HTML=> 
"<iframe src='https://docs.google.com/presentation/d/1pk0FxsamBuZsVh1WGGmHGEb5AlfC68KUlz7zRRIYAUg/embed#slide=id.i0'
frameborder='0' width='555' height='451'></iframe>", 
TeX =>
"An embedded Google slide show."
);

Setup: We create a mode dependent variable $slideshow that displays a Google slideshow inside an html iframe when in html mode, and the message "An embedded Google slide show." in TeX mode. If you omit the TeX mode stuff, then there will be errors when the pdf hardcopy is generated.

Context()->texStrings;
BEGIN_TEXT
${BCENTER}
$slideshow
${ECENTER}
END_TEXT
Context()->normalStrings;

Main Text: Include the $slideshow wherever you like.

$showPartialCorrectAnswers = 1;

Answer Evaluation:

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area