Differences
This shows you the differences between two versions of the page.
litespeed_wiki:cache:litemage:troubleshooting:private-info-in-public-block [2016/05/11 13:58] Rob Holda created |
litespeed_wiki:cache:litemage:troubleshooting:private-info-in-public-block [2017/05/08 21:05] Lisa Clarke |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOTOC~~ | ||
====== Handling Private Information Inside Of A Public Block ====== | ====== Handling Private Information Inside Of A Public Block ====== | ||
- | Private holes can only be punched at the block level. If a piece of private information does not have its own block, we have to add a block in order to inject the ESI process. | + | ==== Problem ==== |
+ | Private holes can only be punched at the block level. If a piece of private information does not have its own block, a hole cannot be punched. | ||
- | For example, a user review input form is integrated into a product page by a customized theme. The form can be varied according to each product, and the default nickname is varied by each logged in user. You cannot simply configure the whole page/block to be private. | + | ==== Solution === |
+ | Add a block for the private information in order to inject the ESI process. | ||
- | As of version 1.0.2, sample code has been added to demonstrate how to handle private information inside of a public block. There are a few steps to be followed. | + | For example, a user review input form is integrated into a product page by a customized theme. The form can be varied according to each product, and the default nickname is varied by each logged in user. You cannot simply configure the whole page/block to be private. You will need to create a new private block inside of the review form block. |
+ | As of version 1.0.2, sample code has been added to demonstrate how to handle private information inside of a public block. There are a few steps to be followed: | ||
- | * In the corresponding layout file, add a block. For example: customized_theme/layout/catalog.xml | + | - In the corresponding layout file, add a block. For example: ''customized_theme/layout/catalog.xml'' \\ \\ old:<code> |
- | old: | + | <block as="review_form" name="product.review.form" template="review/form.phtml" type="review/form"/> |
- | <block as="review_form" name="product.review.form" template="review/form.phtml" type="review/form"/> | + | </code> \\ new:<code> |
- | new: | + | <block as="review_form" name="product.review.form" template="review/form.phtml" type="review/form"> |
- | <block as="review_form" name="product.review.form" template="review/form.phtml" type="review/form"> | + | <block type="litemage/inject_nickname" name="nickname" as="nickname"/> |
- | <block type="litemage/inject_nickname" name="nickname" as="nickname"/> | + | </block> |
- | </block> | + | </code> \\ **Note:** The sample code is shipped by default under ''Litemage/Block/Inject/Nickname.php''. |
+ | - Modify the template to use the newly injected block for the value. \\ \\ old: <code><input type="text" name="nickname" id="nickname_field" class="input-text required-entry" value="<?php echo $this->htmlEscape($data->getNickname()) ?>" required/></code> new: <code><input type="text" name="nickname" id="nickname_field" class="input-text required-entry" value="<?php echo $this->getChildHtml('nickname') ?>" required/></code> | ||
+ | - Since this is inside the value quote, you must add ''$v'' after the block name or block type in LiteMage's ''config.xml'' to avoid extra info/debug info from being output to browser. | ||
- | The sample code is shipped by default under Litemage/Block/Inject/Nickname.php. | + | ==== Note ==== |
- | + | As always, if you have any customizations, please make these changes in your local directory or create a backup as they will otherwise be overridden by future LiteMage updates. | |
- | * Modify the template to use the newly injected block for the value. | + | |
- | old: | + | |
- | <input type="text" name="nickname" id="nickname_field" class="input-text required-entry" value="<?php echo $this->htmlEscape($data->getNickname()) ?>" required/> | + | |
- | + | ||
- | new: | + | |
- | <input type="text" name="nickname" id="nickname_field" class="input-text required-entry" value="<?php echo $this->getChildHtml('nickname') ?>" required/> | + | |
- | + | ||
- | * Since this is inside the value quote, you must add $v after the block name or block type in LiteMage's config.xml to avoid extra info/debug info from being output to browser. | + | |
- | + | ||
- | Again, if you have any customizations, please make these changes in your local directory or create a backup as they will otherwise be overridden by future LiteMage updates. | + |