#79. Changing Photoshop Layers in a GoLive Smart Object
Smart Objects in GoLive offer you incredible flexibility in what you can do with native CS2 files dragged onto a GoLive page (see #70). Yet believe it or not, there's more. It's possible to change the text or visibility of layers in a Photoshop Smart Object right in GoLive.
Updating Variable Settings
Once you've added your Photoshop Smart Object with variables to a page, you can update your variable settings by selecting the Smart Object and opening the Inspector palette. Click the Variables button in the Basic tab, and the Variable Settings dialog will become available to you once again to make any changes.
If you create a Smart Object from a Photoshop file that has a type layer as its topmost layer, you'll be able to change the text in that type layer when you drag the file into GoLive. GoLive will prompt you with a Variable Settings dialog where you can click the Use check box and enter different text for the type layer (Figure 79a).
Figure 79a. If your Photoshop file has a type layer as its topmost layer, GoLive will prompt you with this dialog when you drag the file onto a Web page.
If you'd like to gain this level of flexibility for lower-level type layers or the visibility of layers, you'll first have to define them as variables in Photoshop. But don't let the techie term put you off; variables are surprisingly easy to set up.
Here's how to set up variables in Photoshop for use in GoLive:
With your source file open in Photoshop, choose Image > Variables > Define.
In the Variables dialog (Figure 79b), choose the layer you'd like to define as a variable for from the Layer menu. Type layers offer visibility and text replacement options, whereas image layers offer visibility and pixel replacement optionsalthough the pixel replacement option isn't pertinent to this technique.
Figure 79b. Use the Variables dialog to define which layers and their properties should become variables.
Select the options you'd like to enable and supply meaningful names for the variables. Make sure your variable names start with a letter and don't contain any spaces. You can use underscores or change case to help separate words in your variable names.
Repeat this process for however many layers you'd like to be able to change in GoLive. When you're done, save the Photoshop file to your GoLive project site folder in the webdata\SmartObjects folder.
With your variables set in Photoshop, you can then see them in action:
In GoLive, drag your Photoshop file from the Smart Objects folder in the Extras tab of your site window onto a GoLive page. The Variable Settings dialog appears with all your defined variables (Figure 79c).
Figure 79c. You can change the values of any variables you defined in your Photoshop file when you drag it into a GoLive document.
Check the Use check box related to any variables you'd like to adjust. Text replacement variables offer a text box for you to enter new text for that layer. Visibility variables provide you with a menu to toggle the visibility of that layer. When you're done adjusting the settings, click OK.
Decide on your optimization settings in the Save for Web window and choose a location for the optimized file. Your Photoshop Smart Object shows up on your page with the new text or visibility settings you've entered.