aliceaod Posted February 13, 2008 Posted February 13, 2008 Hi I don't know much php so I am hoping someone can help me or point me to a thread where this is already discussed (tried a search but didn't find anything). I would like to do a php include on the main page (language/english/index.php). Is it possible to do a php include? I like to use DreamWeaver and DreamWeaver doesn't see anything in "design mode" on the index.php because of the way the document is coded. Right now I have it for define('TEXT_MAIN', '<?php include("maintext.php"); ?>'); ...but the content of the maintext.php isn't showing up on the main page. Not sure what needs to be done to be able to do a php include... if this is possible. Any help much appreciated!! PS: I've seen the mod for the FCK editor but what I really want is just a simple php include for the content of the main page. Easier for me than all that "find/replace...find/replace" stuff. I experimented by making a page with DreamWeaver and just copying and then pasting the html code between the ' and the ' which worked ok, but I'm still interested in seeing if php include is possible. THANKS!
krnl Posted February 13, 2008 Posted February 13, 2008 The "define" directive is already PHP, so adding php tags within the define directive will not work. Why don't you just update the text with the variable in idex.inc like it's already set up for? in .../includes/languages/english/index.php define('TEXT_MAIN', $TEXT_MAIN); and in .../includes/languages/english/index.inc $TEXT_MAIN = 'Welcome to the widget store. We have the best widgets and we can save you money!'; This text can be pretty much as long as you want. There must be a size limit, but I don't know what it is. It's more than you will ever need to write there, though.
aliceaod Posted February 13, 2008 Author Posted February 13, 2008 The "define" directive is already PHP, so adding php tags within the define directive will not work. Why don't you just update the text with the variable in idex.inc like it's already set up for? in .../includes/languages/english/index.php define('TEXT_MAIN', $TEXT_MAIN); and in .../includes/languages/english/index.inc $TEXT_MAIN = 'Welcome to the widget store. We have the best widgets and we can save you money!'; This text can be pretty much as long as you want. There must be a size limit, but I don't know what it is. It's more than you will ever need to write there, though. Ah, ok. Didn't know about the index.inc thingie. Probably because I don't see index.inc anywhere. I have to create it? I just installed this script about 30 minutes ago...still messing about with it. I like it so far! I might end up converting my other stores over to this one. UPDATE: I tried creating an index.inc and putting in the code as you suggested but nothing is showing up. I'll just copy and paste the html code from DreamWeaver into the index.php since that seems to work best. Thanks anyway.
stonjie Posted February 13, 2008 Posted February 13, 2008 he meant catalog/includes/languages/english/index.php
Guest Posted February 13, 2008 Posted February 13, 2008 What you want is something such as; (in catalog/index.php near the bottom) <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="main" align="center"><?php include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_MAINTEXT); ?></td> </tr> <?php include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?> </table></td> </tr> Then in catalog/includes/filenames.php add; define('FILENAME_MAINTEXT', 'maintext.php'); Then add the blank page catalog/includes/languages/english/maintext.php On that page you can add whatever you want and it will show up on the main page. This can be done for all pages and also keeps it multi language.
aliceaod Posted February 13, 2008 Author Posted February 13, 2008 Oh, sweet! Thanks everyone for such speedy replies. I'll give this another shot and if you don't hear back from me, it's because I was successul! LOL (No news is good news...hehe) Thankies again!
hecticben Posted March 4, 2008 Posted March 4, 2008 NOT FINISHED Hey all, I'm having the same problem, but for a different reason. I'm using CuteNews to display the news. However, to do this, I need to be able to include "news/shownews.php" in the index language file. However, as stated above, you can't have includes in the language file. Does anyone know a way around this? The method above wouldn't work for me. Thanks! Ben
Arun Posted March 5, 2008 Posted March 5, 2008 What about replaceing TEXT_MAIN in index.php by <?php include ('news/shownews.php'); ?> OR adding somewhere next to TEXT_MAIN. NOTE: 1. do not add <?php ... ?> into another <?php ... ?> that case add just include ('news/shownews.php'); 2. pls make sure you have correct path 'news/shownews.php'
jonquil Posted March 5, 2008 Posted March 5, 2008 Short resource:http://www.tizag.com/phpT/include.php This is also very neat and tidy: Page Editor jon It's all just ones and zeros....
hecticben Posted March 10, 2008 Posted March 10, 2008 I made a fix, to anyone who has this problem. The solution was, I wasn't thinking clearly lol. I didn't want to put my include into the main index.php file, as I didn't want it to show up on every page, just the main page. However, if you read the php carefully, it has it's own section devoted just for the main page, so I just added my include beneath the TEXT_MAIN code. and tada! Thanks to everyone who helped. B
Recommended Posts
Archived
This topic is now archived and is closed to further replies.