Hello Alfie,
When you call an external file from your skin file, the file has to be ".ascx" (not aspx). Also, you can't have <%@ Page Language="VB" %> line on the external file. It'll break the skin. Don't ask me why. Something to do with... something lol. It's DNN Skin rule (or not..).
You can do following alternative way (Javascript):
1. Place <%@ Register TagPrefix="dnn" TagName="DisplayPortalID" Src="~/Portals/_default/Skins/MySkin/MyExternalFiles/MyScript.ascx" %> on your skin file. Create the MyScript.ascx.
2. Place <dnn:DisplayPortalID runat="server"/> on your skin file (MySkin.ascx - where you want to make the portalid appear)
3. Place a following code on your skin file(MySkin.ascx). The code has to be placed AFTER you call <dnn:DisplayPortalID runat="server"/>. If you place it on the bottom of the skin file, that's safe.
<script language="JavaScript">
<!--
var CurrentPortalID = <%= PortalSettings.ActiveTab.PortalId %>;
GetPortalID(CurrentPortalID);
//-->
</script>
4. On your "MyScript.ascx" file, place a following code:
<script language="JavaScript">
<!--
function GetPortalID(CurrentPortalID){
document.write(CurrentPortalID)
}
//-->
</script>
This should display PortalID on your site. You can expand the GetPortalID function. You can't call up PortalID directly from MyScript.ascx (your external file). You need to call it on MySkin.ascx ( on Step 3) and call it from MyScript.ascx.
Can somebody explain why it like this? I am not aguring how the skin works. I just simply can't explain it. Or.... correct me if i am totally wrong.