function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Afzaal HassanAfzaal Hassan 

getting apex:page error

I am trying to create a visualforce component but I keep on getting the following error:
<apex:page> is required and must be the outermost tag in the markup at line 1 column 1
I am not sure what I am doing wrong. Here is my component code(IncludeAttachment.vf):
<apex:component controller="LCD_IncludeAttachmentsController" access="global">
    <apex:attribute name="opportunityId"
        description="Opportunity Id"
        type="Id" />

    <apex:outputText value="{!PageContents}" escape="false" />

I went to setup and clicked classic email template. I create a template and inclded the following:
<messaging:emailTemplate subject="Invoice Attached" recipientType="Opportunity" relatedToType="Opportunity" replyTo=""> <messaging:attachment renderAs="PDF" filename="Invoice.pdf"> <c:IncludeAttachments contactId="{!relatedTo.Id}"/> </messaging:attachment> <messaging:htmlEmailBody > <html xmlns=""> Please find your invoice attached. </html> </messaging:emailTemplate>

So I am calling the component and therefore I dont understand what tag I need to use to wrap the actual component. I keep on getting that error on the IncludeAttachment vf page. When I wrap that around apex:page, i get another saying i cant use apex:component. Can someone please help. If you need to see the controller, I can include that too.
Thank you
Danish HodaDanish Hoda
Hi Afzaal,
Please check whether your component extension is .vfc or .vf.